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:



173
174
175
176
177
178
179
180
# File 'lib/sunspot/type.rb', line 173

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

.indexed_name(name) ⇒ Object

:nodoc:



163
164
165
# File 'lib/sunspot/type.rb', line 163

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

.to_indexed(value) ⇒ Object

:nodoc:



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

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