Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattpolito/required_options
Guard your methods
https://github.com/mattpolito/required_options
Last synced: 12 days ago
JSON representation
Guard your methods
- Host: GitHub
- URL: https://github.com/mattpolito/required_options
- Owner: mattpolito
- License: mit
- Created: 2011-09-23T20:44:55.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2011-10-06T18:43:47.000Z (about 13 years ago)
- Last Synced: 2024-10-05T20:41:12.269Z (3 months ago)
- Language: Ruby
- Homepage:
- Size: 109 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
RequiredOptions
=======# DESCRIPTION
Guard your methods against those slacker options that 'forget' to come to class.
# INSTALLATION
Add gem to your project.
If using bundler
gem 'required_options'
# USAGE
Just declare which components of your options hash that you can't live without
def some_method_with_options(arg, opts = {})
required_options opts, :track_name, :band_name# do some really smart work here
endIf a required option is not passed into the method, it will raise a `MissingOptions` exception that displays the forgotten option.