Class: Momo::BlockHash
- Inherits:
-
Object
- Object
- Momo::BlockHash
- Defined in:
- lib/momo/momoscope.rb
Instance Attribute Summary collapse
-
#props ⇒ Object
Returns the value of attribute props.
Instance Method Summary collapse
-
#initialize(options, &block) ⇒ BlockHash
constructor
A new instance of BlockHash.
- #method_missing(name, *args, &block) ⇒ Object
Constructor Details
#initialize(options, &block) ⇒ BlockHash
Returns a new instance of BlockHash.
7 8 9 10 11 |
# File 'lib/momo/momoscope.rb', line 7 def initialize(, &block) = @props = {} instance_eval(&block) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/momo/momoscope.rb', line 13 def method_missing(name, *args, &block) if /^[[:upper:]]/.match(name) == nil raise "Invalid property name: #{name}" end @props[name] = Momo.resolve(args[0], , &block) end |
Instance Attribute Details
#props ⇒ Object
Returns the value of attribute props.
6 7 8 |
# File 'lib/momo/momoscope.rb', line 6 def props @props end |