Project

optionally

0.0
No commit activity in last 3 years
No release in over 3 years
Quick and dirty required fields for options hashes
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.9
~> 10.0
~> 3.2
 Project Readme

Optionally

This is, like, so totally just a tiny little mix-in that lets your classes be super cereals about the stuff their methods get in options hashes, fersure.

Installation

Add this line to your application's Gemfile:

gem 'optionally'

And then execute:

$ bundle

Or install it yourself as:

$ gem install optionally

Usage

require 'optionally'

class Something
  include Optionally::Required

  def fersure(options = {})
    check_required_options(options, :totally)

    puts "totally #{options[:totally]}"
  end
end

s = Something.new
s.fersure(totally: 'like, freal')
#  "totally like, freal"
#  => nil

s.fersure(bummer: "gag me with a spoon")
#  ArgumentError: totally is required
#  Big Ugly Stacktrace (TM)

Contributing

Do you use git-flow? I sure do. Please base anything you do off of the develop branch.

  1. Fork it.
  2. Perform some BDD magic. Seriously. Be testing.
  3. Submit a pull request.

License

MIT License. Copyright 2015 Dennis Walters