Module: Datagrid::Filters::SelectOptions

Included in:
DynamicFilter, EnumFilter
Defined in:
lib/datagrid/filters/select_options.rb

Instance Method Summary collapse

Instance Method Details

#include_blankObject


14
15
16
17
18
19
# File 'lib/datagrid/filters/select_options.rb', line 14

def include_blank
  unless prompt
    options.has_key?(:include_blank) ?
      Datagrid::Utils.callable(options[:include_blank]) : !multiple?
  end
end

#promptObject


21
22
23
# File 'lib/datagrid/filters/select_options.rb', line 21

def prompt
  options.has_key?(:prompt) ? Datagrid::Utils.callable(options[:prompt]) : false
end

#select(object) ⇒ Object


3
4
5
6
7
8
9
10
11
12
# File 'lib/datagrid/filters/select_options.rb', line 3

def select(object)
  select = self.options[:select]
  if select.is_a?(Symbol)
    object.send(select)
  elsif select.respond_to?(:call)
    Datagrid::Utils.apply_args(object, &select)
  else
    select
  end
end