Class: Datagrid::Filters::FloatFilter

Inherits:
BaseFilter
  • Object
show all
Includes:
RangedFilter
Defined in:
lib/datagrid/filters/float_filter.rb

Constant Summary

Constants included from RangedFilter

RangedFilter::SERIALIZED_RANGE

Instance Attribute Summary

Attributes inherited from BaseFilter

#block, #grid_class, #name, #options

Instance Method Summary collapse

Methods included from RangedFilter

#default_filter_where, #parse_values, #range?

Methods inherited from BaseFilter

#allow_blank?, #allow_nil?, #apply, #default, #default_scope?, #dummy?, #enabled?, #enum_checkboxes?, form_builder_helper_name, #form_builder_helper_name, #format, #header, #initialize, #input_options, #label_options, #multiple?, #parse_values, #range?, #separator, #supports_range?, #type, #unapplicable_value?

Constructor Details

This class inherits a constructor from Datagrid::Filters::BaseFilter

Instance Method Details

#default_input_optionsObject



8
9
10
# File 'lib/datagrid/filters/float_filter.rb', line 8

def default_input_options
  { **super, type: "number", step: "any" }
end

#parse(value) ⇒ Object



12
13
14
15
16
# File 'lib/datagrid/filters/float_filter.rb', line 12

def parse(value)
  return nil if value.blank?

  value.to_f
end