class TableHelp::Strategy

Attributes

name[R]
symbol_or_proc[R]

Public Class Methods

new(name, symbol_or_proc) click to toggle source
# File lib/table_help/strategy.rb, line 5
def initialize(name, symbol_or_proc)
  @name = name
  @symbol_or_proc = symbol_or_proc
end

Public Instance Methods

to_value(record, context = nil) click to toggle source
# File lib/table_help/strategy.rb, line 10
def to_value(record, context = nil)
  case symbol_or_proc
  when Symbol, String
    record.send(symbol_or_proc)
  when Proc
    context.capture { symbol_or_proc.call(record) }
  else
    record.send(name)
  end
end