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