Module: 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.

Class Method Summary collapse

Class Method Details

.cast(string) ⇒ Object

:nodoc:



177
178
179
180
181
182
183
184
# File 'lib/sunspot/type.rb', line 177

def cast(string) #:nodoc:
  case string
  when 'true'
    true
  when 'false'
    false
  end
end

.indexed_name(name) ⇒ Object

:nodoc:



167
168
169
# File 'lib/sunspot/type.rb', line 167

def indexed_name(name) #:nodoc:
"#{name}_b"
end

.to_indexed(value) ⇒ Object

:nodoc:



171
172
173
174
175
# File 'lib/sunspot/type.rb', line 171

def to_indexed(value) #:nodoc:
  unless value.nil?
    value ? 'true' : 'false'
  end
end