class Ransack::Ransacker

Attributes

args[R]
formatter[R]
name[R]
type[R]

Public Class Methods

new(klass, name, opts = {}, &block) click to toggle source
# File lib/ransack/ransacker.rb, line 8
def initialize(klass, name, opts = {}, &block)
  @klass, @name = klass, name

  @type = opts[:type] || :string
  @args = opts[:args] || [:parent]
  @formatter = opts[:formatter]
  @callable = opts[:callable] || block ||
              (@klass.method(name) if @klass.respond_to?(name)) ||
              proc { |parent| parent.table[name] }
end

Public Instance Methods

attr_from(bindable) click to toggle source
# File lib/ransack/ransacker.rb, line 19
def attr_from(bindable)
  call(*args.map { |arg| bindable.send(arg) })
end