Class: Sunspot::Type::BooleanType
- Inherits:
-
AbstractType
- Object
- AbstractType
- Sunspot::Type::BooleanType
- Defined in:
- lib/sunspot/type.rb
Overview
The boolean type represents true/false values. Note that nil
will not be indexed at all; only false
will be indexed with a false value.
Instance Method Summary collapse
-
#cast(string) ⇒ Object
:nodoc:.
-
#indexed_name(name) ⇒ Object
:nodoc:.
-
#to_indexed(value) ⇒ Object
:nodoc:.
Methods inherited from AbstractType
#accepts_dynamic?, #accepts_more_like_this?, instance, #to_literal
Instance Method Details
#cast(string) ⇒ Object
:nodoc:
314 315 316 317 318 319 320 321 |
# File 'lib/sunspot/type.rb', line 314 def cast(string) #:nodoc: case string when 'true' true when 'false' false end end |
#indexed_name(name) ⇒ Object
:nodoc:
304 305 306 |
# File 'lib/sunspot/type.rb', line 304 def indexed_name(name) #:nodoc: "#{name}_b" end |
#to_indexed(value) ⇒ Object
:nodoc:
308 309 310 311 312 |
# File 'lib/sunspot/type.rb', line 308 def to_indexed(value) #:nodoc: unless value.nil? value ? 'true' : 'false' end end |