Created
August 21, 2011 05:54
-
-
Save basicxman/1160213 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --someboolean | |
| --someoption "Foo bar baz." | |
| --someotheroption "bar." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # I wanted to have a configuration file for my Slop options, | |
| # but Slop doesn't support this by default, anything specified | |
| # in ARGV should have higher priority over the config file. | |
| class Slop | |
| alias :option_core :option | |
| def option(*args, &block) | |
| args << {} unless args.last.is_a? Hash | |
| key = (args.first.is_a? Symbol and args[1].is_a? Symbol) ? args[1] : args.first | |
| args.last[:default] = $default[key] if $default.has_key? key | |
| return option_core(*args, &block) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment