README in ahoward-options-2.0.0 vs README in ahoward-options-2.1.1

- old
+ new

@@ -24,18 +24,19 @@ INSTALL gem install options SAMPLES + <========< samples/a.rb >========> ~ > cat samples/a.rb require 'options' - # options.rb makes is super easy to deal with keyword options in a safe and + # options.rb makes it super easy to deal with keyword options in a safe and # easy way. # def method(*args) args, options = Options.parse(args) @@ -145,7 +146,34 @@ {:args=>[:a, :b, {:k=>:v}]} {:options=>{:k=>:v}} {:args=>[:a, :b]} {:options=>{:k=>:v}} + + + <========< samples/d.rb >========> + + ~ > cat samples/d.rb + + require 'options' + + # options.rb makes it easy to provide good error messages when people + # misuse a method. + # + + def method(*args) + args, options = Options.parse(args) + options.validate(:force) + + force = options.getopt(:force, default=false) + p force + end + + method(:foo, :bar, :force => true) + + + + ~ > ruby samples/d.rb + + true