Class: Assert::Options::Base
- Inherits:
-
Object
- Object
- Assert::Options::Base
- Defined in:
- lib/assert/options.rb
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/assert/options.rb', line 5 def method_missing(method, *args, &block) if args.empty? self.instance_variable_get("@#{method}") else value = args.size == 1 ? args.first : args self.instance_variable_set("@#{method}", value) if method.to_s =~ /^default_/ self.instance_variable_set("@#{$'}", value) end end end |