Class: AttrSearchableGrammar::Attributes::Boolean

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

Instance Attribute Summary

Attributes inherited from Base

#attribute, #options

Instance Method Summary collapse

Methods inherited from WithoutMatches

#matches

Methods inherited from Base

#compatible?, #fulltext?, #initialize, #method_missing, #respond_to?

Constructor Details

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

Dynamic Method Handling

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

Instance Method Details

#map(value) ⇒ Object



218
219
220
221
222
223
# File 'lib/attr_searchable_grammar/attributes.rb', line 218

def map(value)
  return true if value.to_s =~ /^(1|true|yes)$/i
  return false if value.to_s =~ /^(0|false|no)$/i

  raise AttrSearchable::IncompatibleDatatype, "Incompatible datatype for #{value}"
end