Class: SpinningWheel::Fabric::DSL
- Inherits:
-
Object
- Object
- SpinningWheel::Fabric::DSL
- Defined in:
- lib/spinning_wheel/fabric.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ DSL
constructor
A new instance of DSL.
- #method_missing(name, *args, &block) ⇒ Object
Constructor Details
#initialize ⇒ DSL
Returns a new instance of DSL.
40 41 42 43 |
# File 'lib/spinning_wheel/fabric.rb', line 40 def initialize() @attributes = Hash.new clean_up_object_methods() end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
45 46 47 |
# File 'lib/spinning_wheel/fabric.rb', line 45 def method_missing(name, *args, &block) @attributes[name] = block.call end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
32 33 34 |
# File 'lib/spinning_wheel/fabric.rb', line 32 def attributes @attributes end |
Class Method Details
.run(block) ⇒ Object
34 35 36 37 38 |
# File 'lib/spinning_wheel/fabric.rb', line 34 def self.run(block) dsl = self.new dsl.instance_eval(&block) return dsl.attributes end |