Method: Ransack::Ransacker#initialize

Defined in:
lib/ransack/ransacker.rb

#initialize(klass, name, opts = {}, &block) ⇒ Ransacker

Returns a new instance of Ransacker.



8
9
10
11
12
13
14
15
16
17
# 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