Class: Expo2::SubCollection

Inherits:
Struct
  • Object
show all
Defined in:
lib/expo2.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



119
120
121
# File 'lib/expo2.rb', line 119

def associator
  @associator
end

#blockObject

Returns the value of attribute block

Returns:

  • (Object)

    the current value of block



119
120
121
# File 'lib/expo2.rb', line 119

def block
  @block
end

#keyObject

Returns the value of attribute key

Returns:

  • (Object)

    the current value of key



119
120
121
# File 'lib/expo2.rb', line 119

def key
  @key
end

#sub_expoObject

Returns the value of attribute sub_expo

Returns:

  • (Object)

    the current value of sub_expo



119
120
121
# File 'lib/expo2.rb', line 119

def sub_expo
  @sub_expo
end

Instance Method Details

#go(object, context, index = nil) ⇒ Object



120
121
122
123
124
# File 'lib/expo2.rb', line 120

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



125
126
127
# File 'lib/expo2.rb', line 125

def inspect
  "<Expo2::SubCollection>"
end