Sha256: c5b111686996c3537fd1dc99dbe82718cec7e22ac8f91c97d43a097cdfdcddc2
Contents?: true
Size: 596 Bytes
Versions: 9
Compression:
Stored size: 596 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
9 entries across 9 versions & 1 rubygems