Class: ActiveFedora::Indexing::Map::IndexObject
- Inherits:
-
Object
- Object
- ActiveFedora::Indexing::Map::IndexObject
- Defined in:
- lib/active_fedora/indexing/map.rb
Overview
this enables a cleaner API for solr integration
Instance Attribute Summary collapse
-
#behaviors ⇒ Object
Returns the value of attribute behaviors.
-
#data_type ⇒ Object
Returns the value of attribute data_type.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#term ⇒ Object
Returns the value of attribute term.
Instance Method Summary collapse
- #as(*args) ⇒ Object
- #dup ⇒ Object
-
#initialize(name, behaviors: []) {|_self| ... } ⇒ IndexObject
constructor
A new instance of IndexObject.
- #type(sym) ⇒ Object
Constructor Details
#initialize(name, behaviors: []) {|_self| ... } ⇒ IndexObject
Returns a new instance of IndexObject.
30 31 32 33 34 35 |
# File 'lib/active_fedora/indexing/map.rb', line 30 def initialize(name, behaviors: [], &_block) @behaviors = behaviors @data_type = :string @key = name yield self if block_given? end |
Instance Attribute Details
#behaviors ⇒ Object
Returns the value of attribute behaviors.
27 28 29 |
# File 'lib/active_fedora/indexing/map.rb', line 27 def behaviors @behaviors end |
#data_type ⇒ Object
Returns the value of attribute data_type.
27 28 29 |
# File 'lib/active_fedora/indexing/map.rb', line 27 def data_type @data_type end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
28 29 30 |
# File 'lib/active_fedora/indexing/map.rb', line 28 def key @key end |
#term ⇒ Object
Returns the value of attribute term.
27 28 29 |
# File 'lib/active_fedora/indexing/map.rb', line 27 def term @term end |
Instance Method Details
#as(*args) ⇒ Object
37 38 39 40 |
# File 'lib/active_fedora/indexing/map.rb', line 37 def as(*args) @term = args.last.is_a?(Hash) ? args.pop : {} @behaviors = args end |
#dup ⇒ Object
46 47 48 49 50 |
# File 'lib/active_fedora/indexing/map.rb', line 46 def dup self.class.new(@key) do |idx| idx.behaviors = @behaviors.dup end end |
#type(sym) ⇒ Object
42 43 44 |
# File 'lib/active_fedora/indexing/map.rb', line 42 def type(sym) @data_type = sym end |