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, #field_names, #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:



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

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

  false
end

#map(value) ⇒ Object



201
202
203
# File 'lib/search_cop_grammar/attributes.rb', line 201

def map(value)
  value.to_f
end