Class: ActionFactory::Assignments::Trait
- Inherits:
-
Object
- Object
- ActionFactory::Assignments::Trait
- Defined in:
- lib/action_factory/assignments/trait.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #compile(factory) ⇒ Object
-
#initialize(block) ⇒ Trait
constructor
A new instance of Trait.
Constructor Details
#initialize(block) ⇒ Trait
Returns a new instance of Trait.
8 9 10 |
# File 'lib/action_factory/assignments/trait.rb', line 8 def initialize(block) @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
6 7 8 |
# File 'lib/action_factory/assignments/trait.rb', line 6 def block @block end |
Instance Method Details
#==(other) ⇒ Object
16 17 18 |
# File 'lib/action_factory/assignments/trait.rb', line 16 def ==(other) other.is_a?(self.class) && other.block == @block end |
#compile(factory) ⇒ Object
12 13 14 |
# File 'lib/action_factory/assignments/trait.rb', line 12 def compile(factory) factory.instance_exec(factory.instance, &@block) end |