class One::Pivot

Simple class to hold meta information about a pivot. This class was created to support invoking One::Pivot#multi_pivot with identifiers for each pivot.

Attributes

identifier[R]
pivot_proc[R]

Public Class Methods

new(identifier, &block) click to toggle source

Constructor. param [String, Symbol] identifier The name of the pivot @yield [item] This block will be called for each item in the list when pivot is invoked @yieldparam [Object] item An item in the list @yieldreturn [Object] The value returned from the pivot block will serve as the key in the pivot results

# File lib/one/pivot.rb, line 14
def initialize(identifier, &block)
  raise LocalJumpError.new("no block given") unless block_given?
  @identifier = identifier
  @pivot_proc = block
end