Class: SubCollection

Inherits:
Struct
  • Object
show all
Defined in:
lib/presenters/sub_collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#associatorObject

Returns the value of attribute associator

Returns:

  • (Object)

    the current value of associator



1
2
3
# File 'lib/presenters/sub_collection.rb', line 1

def associator
  @associator
end

#blockObject

Returns the value of attribute block

Returns:

  • (Object)

    the current value of block



1
2
3
# File 'lib/presenters/sub_collection.rb', line 1

def block
  @block
end

#keyObject

Returns the value of attribute key

Returns:

  • (Object)

    the current value of key



1
2
3
# File 'lib/presenters/sub_collection.rb', line 1

def key
  @key
end

#sub_expoObject

Returns the value of attribute sub_expo

Returns:

  • (Object)

    the current value of 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

#inspectObject



8
9
10
# File 'lib/presenters/sub_collection.rb', line 8

def inspect
  "<Expo2::SubCollection>"
end