Class: Sunspot::Type::FloatType

Inherits:
AbstractType show all
Defined in:
lib/sunspot/type.rb

Overview

The Float type represents floating-point numbers.

Direct Known Subclasses

DoubleType, TrieFloatType

Instance Method Summary collapse

Methods inherited from AbstractType

#accepts_dynamic?, #accepts_more_like_this?

Instance Method Details

#cast(string) ⇒ Object

:nodoc:



180
181
182
# File 'lib/sunspot/type.rb', line 180

def cast(string) #:nodoc:
  string.to_f
end

#indexed_name(name) ⇒ Object

:nodoc:



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

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

#to_indexed(value) ⇒ Object

:nodoc:



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

def to_indexed(value) #:nodoc:
  value.to_f.to_s if value
end

#to_literal(value) ⇒ Object



176
177
178
# File 'lib/sunspot/type.rb', line 176

def to_literal(value)
  to_indexed(value)
end