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:



143
144
145
146
147
148
149
150
# File 'lib/sunspot/type.rb', line 143

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

.indexed_name(name) ⇒ Object

:nodoc:



133
134
135
# File 'lib/sunspot/type.rb', line 133

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

.to_indexed(value) ⇒ Object

:nodoc:



137
138
139
140
141
# File 'lib/sunspot/type.rb', line 137

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