Class: Sunspot::FieldFactory::Join

Inherits:
Abstract
  • Object
show all
Defined in:
lib/sunspot/field_factory.rb

Instance Attribute Summary

Attributes inherited from Abstract

#name

Instance Method Summary collapse

Methods inherited from Abstract

#populate_document

Constructor Details

#initialize(name, type, options = {}, &block) ⇒ Join

Returns a new instance of Join.



102
103
104
105
106
107
108
# File 'lib/sunspot/field_factory.rb', line 102

def initialize(name, type, options = {}, &block)
  super(options[:prefix] ? "#{options[:prefix]}_#{name}" : name, options, &block)
  unless name.to_s =~ /^\w+$/
    raise ArgumentError, "Invalid field name #{name}: only letters, numbers, and underscores are allowed."
  end
  @field = JoinField.new(self.name, type, options)
end

Instance Method Details

#buildObject

Return the field instance built by this factory



113
114
115
# File 'lib/sunspot/field_factory.rb', line 113

def build
  @field
end

#signatureObject

A unique signature identifying this field by name and type.



120
121
122
# File 'lib/sunspot/field_factory.rb', line 120

def signature
  ['join', @field.name, @field.type]
end