Class: ROM::Factory::Attributes::Sequence
- Inherits:
-
Object
- Object
- ROM::Factory::Attributes::Sequence
- Defined in:
- lib/rom/factory/attributes/sequence.rb
Instance Attribute Summary collapse
- #block ⇒ Object readonly
- #count ⇒ Object readonly
- #name ⇒ Object readonly
Instance Method Summary collapse
- #call(*args) ⇒ Object
- #dependency_names ⇒ Object
- #increment ⇒ Object
-
#initialize(name, &block) ⇒ Sequence
constructor
A new instance of Sequence.
- #parameters ⇒ Object
- #to_proc ⇒ Object
Constructor Details
#initialize(name, &block) ⇒ Sequence
Returns a new instance of Sequence.
8 9 10 11 12 |
# File 'lib/rom/factory/attributes/sequence.rb', line 8 def initialize(name, &block) @name = name @count = 0 @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
6 7 8 |
# File 'lib/rom/factory/attributes/sequence.rb', line 6 def block @block end |
#count ⇒ Object (readonly)
6 7 8 |
# File 'lib/rom/factory/attributes/sequence.rb', line 6 def count @count end |
#name ⇒ Object (readonly)
6 7 8 |
# File 'lib/rom/factory/attributes/sequence.rb', line 6 def name @name end |
Instance Method Details
#call(*args) ⇒ Object
14 15 16 |
# File 'lib/rom/factory/attributes/sequence.rb', line 14 def call(*args) block.call(increment, *args) end |
#dependency_names ⇒ Object
26 27 28 |
# File 'lib/rom/factory/attributes/sequence.rb', line 26 def dependency_names EMPTY_ARRAY end |
#increment ⇒ Object
22 23 24 |
# File 'lib/rom/factory/attributes/sequence.rb', line 22 def increment @count += 1 end |
#parameters ⇒ Object
30 31 32 |
# File 'lib/rom/factory/attributes/sequence.rb', line 30 def parameters block.parameters end |
#to_proc ⇒ Object
18 19 20 |
# File 'lib/rom/factory/attributes/sequence.rb', line 18 def to_proc method(:call).to_proc end |