class Indago::Field

Attributes

name[R]

Public Class Methods

for(name) click to toggle source
# File lib/indago/field.rb, line 15
def self.for(name)
  case name.to_s
  when /^(\w+)_cont$/ then Contain.new(name.to_sym, $1.to_sym)
  else raise Indago::Error, "Cannot find a proper field for #{name.inspect}"
  end
end
new(name, &block) click to toggle source
# File lib/indago/field.rb, line 6
def initialize(name, &block)
  @name = name
  @block = block
end

Public Instance Methods

call(scope, value) click to toggle source
# File lib/indago/field.rb, line 11
def call(scope, value)
  @block.call(scope, value)
end