Class: SubCollection
- Inherits:
-
Struct
- Object
- Struct
- SubCollection
- Defined in:
- lib/presenters/sub_collection.rb
Instance Attribute Summary collapse
-
#associator ⇒ Object
Returns the value of attribute associator.
-
#block ⇒ Object
Returns the value of attribute block.
-
#key ⇒ Object
Returns the value of attribute key.
-
#sub_expo ⇒ Object
Returns the value of attribute sub_expo.
Instance Method Summary collapse
Instance Attribute Details
#associator ⇒ Object
Returns the value of attribute associator
1 2 3 |
# File 'lib/presenters/sub_collection.rb', line 1 def associator @associator end |
#block ⇒ Object
Returns the value of attribute block
1 2 3 |
# File 'lib/presenters/sub_collection.rb', line 1 def block @block end |
#key ⇒ Object
Returns the value of attribute key
1 2 3 |
# File 'lib/presenters/sub_collection.rb', line 1 def key @key end |
#sub_expo ⇒ Object
Returns the value of attribute sub_expo
1 2 3 |
# File 'lib/presenters/sub_collection.rb', line 1 def sub_expo @sub_expo end |
Instance Method Details
#go(object, context, index = nil) ⇒ Object
2 3 4 5 6 |
# File 'lib/presenters/sub_collection.rb', line 2 def go(object, context, index=nil) associated = self.associator.to_proc.call(object) sub = Expo2.new(self.sub_expo, &self.block) { self.key => sub.expo_collection(associated, context) } end |
#inspect ⇒ Object
8 9 10 |
# File 'lib/presenters/sub_collection.rb', line 8 def inspect "<Expo2::SubCollection>" end |