README.md in option_initializer-1.1.1 vs README.md in option_initializer-1.1.2
- old
+ new
@@ -17,16 +17,17 @@
include OptionInitializer
option_initializer :id, :name, :age, :greetings
option_validator do |k, v|
case k
when :age
- raise ArgumentError, "invalid age" if age < 0
+ raise ArgumentError, "invalid age" if v < 0
when :name
- raise ArgumentError, "invalid name" if name.empty?
+ raise ArgumentError, "invalid name" if v.empty?
end
end
def initialize opts
+ validate_options opts
@options = opts
end
def say_hello
puts @options[:greetings].call @options[:name]