Sha256: 0b6ceb5f06d49431fa426b975a616d7e17cd58f6d77b6f3d315d4649e0a403e7
Contents?: true
Size: 594 Bytes
Versions: 17
Compression:
Stored size: 594 Bytes
Contents
module Ransack class Ransacker attr_reader :name, :type, :formatter, :args delegate :call, :to => :@callable 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 def attr_from(bindable) call(*args.map {|arg| bindable.send(arg)}) end end end
Version data entries
17 entries across 17 versions & 2 rubygems