Class: Ferret::Search::FieldCache::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/ferret/search/field_cache.rb

Overview

Expert: Every key in the internal cache is of this type.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field, sort_type, comparator = nil) ⇒ Entry

Creates one of these objects.



14
15
16
17
18
# File 'lib/ferret/search/field_cache.rb', line 14

def initialize(field, sort_type, comparator = nil) 
  @field = field
  @sort_type = sort_type
  @comparator = comparator
end

Instance Attribute Details

#comparatorObject (readonly)

Returns the value of attribute comparator.



12
13
14
# File 'lib/ferret/search/field_cache.rb', line 12

def comparator
  @comparator
end

#fieldObject (readonly)

Returns the value of attribute field.



12
13
14
# File 'lib/ferret/search/field_cache.rb', line 12

def field
  @field
end

#sort_typeObject (readonly)

Returns the value of attribute sort_type.



12
13
14
# File 'lib/ferret/search/field_cache.rb', line 12

def sort_type
  @sort_type
end

Instance Method Details

#eql?(o) ⇒ Boolean Also known as: ==

Two of these are equal iff they reference the same field and sort_type.

Returns:

  • (Boolean)


21
22
23
24
# File 'lib/ferret/search/field_cache.rb', line 21

def eql?(o) 
  return (o.instance_of? Entry and o.field == @field and
          o.sort_type == @sort_type and o.comparator == comparator)
end

#hashObject

Composes a hashcode based on the field and sort_type.



28
29
30
# File 'lib/ferret/search/field_cache.rb', line 28

def hash() 
  return @field.hash ^ @sort_type.hash ^ @comparator.hash
end