Class: ActiveFedora::Indexing::Map::IndexObject

Inherits:
Object
  • Object
show all
Defined in:
lib/active_fedora/indexing/map.rb

Overview

this enables a cleaner API for solr integration

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) {|_self| ... } ⇒ IndexObject

Returns a new instance of IndexObject.

Yields:

  • (_self)

Yield Parameters:



22
23
24
25
26
27
# File 'lib/active_fedora/indexing/map.rb', line 22

def initialize(name, &_block)
  @behaviors = []
  @data_type = :string
  @key = name
  yield self if block_given?
end

Instance Attribute Details

#behaviorsObject

Returns the value of attribute behaviors.



19
20
21
# File 'lib/active_fedora/indexing/map.rb', line 19

def behaviors
  @behaviors
end

#data_typeObject

Returns the value of attribute data_type.



19
20
21
# File 'lib/active_fedora/indexing/map.rb', line 19

def data_type
  @data_type
end

#keyObject (readonly)

Returns the value of attribute key.



20
21
22
# File 'lib/active_fedora/indexing/map.rb', line 20

def key
  @key
end

#termObject

Returns the value of attribute term.



19
20
21
# File 'lib/active_fedora/indexing/map.rb', line 19

def term
  @term
end

Instance Method Details

#as(*args) ⇒ Object



29
30
31
32
# File 'lib/active_fedora/indexing/map.rb', line 29

def as(*args)
  @term = args.last.is_a?(Hash) ? args.pop : {}
  @behaviors = args
end

#dupObject



38
39
40
41
42
# File 'lib/active_fedora/indexing/map.rb', line 38

def dup
  self.class.new(@key) do |idx|
    idx.behaviors = @behaviors.dup
  end
end

#type(sym) ⇒ Object



34
35
36
# File 'lib/active_fedora/indexing/map.rb', line 34

def type(sym)
  @data_type = sym
end