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) {|_self| ... } ⇒ IndexObject
constructor
A new instance of IndexObject.
- #type(sym) ⇒ Object
Constructor Details
#initialize(name) {|_self| ... } ⇒ IndexObject
Returns a new instance of IndexObject.
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
#behaviors ⇒ Object
Returns the value of attribute behaviors.
19 20 21 |
# File 'lib/active_fedora/indexing/map.rb', line 19 def behaviors @behaviors end |
#data_type ⇒ Object
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 |
#key ⇒ Object (readonly)
Returns the value of attribute key.
20 21 22 |
# File 'lib/active_fedora/indexing/map.rb', line 20 def key @key end |
#term ⇒ Object
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 |
#dup ⇒ Object
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 |