Class: SearchCopGrammar::Attributes::Float

Inherits:
WithoutMatches show all
Defined in:
lib/search_cop_grammar/attributes.rb

Direct Known Subclasses

Decimal, Integer

Instance Attribute Summary

Attributes inherited from Base

#attribute, #column_name, #options, #table_alias

Instance Method Summary collapse

Methods inherited from WithoutMatches

#matches

Methods inherited from Base

#fulltext?, #initialize, #method_missing, #respond_to_missing?

Constructor Details

This class inherits a constructor from SearchCopGrammar::Attributes::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class SearchCopGrammar::Attributes::Base

Instance Method Details

#compatible?(value) ⇒ Boolean

Returns:



190
191
192
193
194
# File 'lib/search_cop_grammar/attributes.rb', line 190

def compatible?(value)
  return true if value.to_s =~ /^-?[0-9]+(\.[0-9]+)?$/

  false
end

#map(value) ⇒ Object



196
197
198
# File 'lib/search_cop_grammar/attributes.rb', line 196

def map(value)
  value.to_f
end