Class: MightyGrid::Filters::CustomFilter

Inherits:
Base
  • Object
show all
Defined in:
lib/mighty_grid/filters/custom_filter.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#attribute, #default, #model, #options, #search_value

Instance Method Summary collapse

Constructor Details

#initialize(options = {}, &block) ⇒ CustomFilter

Returns a new instance of CustomFilter.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/mighty_grid/filters/custom_filter.rb', line 6

def initialize(options = {}, &block)
  self.class.default_options.merge!(scope: nil)

  super(options)

  if block_given?
    @scope = block
  else
    @scope = @options.delete(:scope)
  end
end

Instance Attribute Details

#scopeObject (readonly)

Returns the value of attribute scope.



4
5
6
# File 'lib/mighty_grid/filters/custom_filter.rb', line 4

def scope
  @scope
end