Class: Warped::Filter::Integer
- Defined in:
- lib/warped/api/filter/integer.rb
Constant Summary collapse
- RELATIONS =
%w[eq neq gt gte lt lte between in not_in is_null is_not_null].freeze
Instance Attribute Summary
Attributes inherited from Base
#alias_name, #name, #options, #strict
Instance Method Summary collapse
Methods inherited from Base
#initialize, kind, #kind, #parameter_name, #relation, #relations
Constructor Details
This class inherits a constructor from Warped::Filter::Base
Instance Method Details
#cast(value) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/warped/api/filter/integer.rb', line 10 def cast(value) return if value.blank? casted_value = case value when ::Integer value when ::String value.to_i if value.match?(/\A-?\d+\z/) when ::Float, ::BigDecimal value.to_i end check_casted_value!(casted_value) end |
#html_type ⇒ Object
25 26 27 |
# File 'lib/warped/api/filter/integer.rb', line 25 def html_type "number" end |