Class: Hospodar::Builder::Strategies::Link
- Inherits:
-
Struct
- Object
- Struct
- Hospodar::Builder::Strategies::Link
- Defined in:
- lib/hospodar/builder/strategies/link.rb
Instance Attribute Summary collapse
-
#delegate ⇒ Object
Returns the value of attribute delegate.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#step_id ⇒ Object
readonly
Returns the value of attribute step_id.
-
#strategy ⇒ Object
Returns the value of attribute strategy.
Instance Method Summary collapse
Instance Attribute Details
#delegate ⇒ Object
Returns the value of attribute delegate
6 7 8 |
# File 'lib/hospodar/builder/strategies/link.rb', line 6 def delegate @delegate end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
7 8 9 |
# File 'lib/hospodar/builder/strategies/link.rb', line 7 def object @object end |
#step_id ⇒ Object (readonly)
Returns the value of attribute step_id.
7 8 9 |
# File 'lib/hospodar/builder/strategies/link.rb', line 7 def step_id @step_id end |
#strategy ⇒ Object
Returns the value of attribute strategy
6 7 8 |
# File 'lib/hospodar/builder/strategies/link.rb', line 6 def strategy @strategy end |
Instance Method Details
#call ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/hospodar/builder/strategies/link.rb', line 9 def call Enumerator.new do |yielder| strategy.call.inject(nil) do |object, (title, layer_object, id)| @object = layer_object @step_id = id if title.nil? yielder << [layer_object, id] next layer_object end Hospodar::Builder.def_accessor(title, on: layer_object, to: object, delegate: delegate) yielder << [layer_object, id] layer_object end end end |
#last_step ⇒ Object
25 26 27 |
# File 'lib/hospodar/builder/strategies/link.rb', line 25 def last_step step_id.title end |