Class: ActiveFedora::StreamAttribute Abstract
- Inherits:
-
DelegatedAttribute
- Object
- DelegatedAttribute
- ActiveFedora::StreamAttribute
- Defined in:
- lib/active_fedora/attributes/stream_attribute.rb
Overview
This class is abstract.
Abstract class for attributes that are delegated to a serialized representation such as a NonRDFSource
Direct Known Subclasses
Instance Attribute Summary collapse
-
#at ⇒ String
The current value of at.
-
#delegate_target ⇒ String
The current value of delegate_target.
-
#target_class ⇒ String
The current value of target_class.
Attributes inherited from DelegatedAttribute
Instance Method Summary collapse
-
#initialize(field, args = {}) ⇒ StreamAttribute
constructor
A new instance of StreamAttribute.
-
#primary_solr_name ⇒ Object
Gives the primary solr name for a column.
- #type ⇒ Object
Constructor Details
#initialize(field, args = {}) ⇒ StreamAttribute
Returns a new instance of StreamAttribute.
18 19 20 21 22 23 |
# File 'lib/active_fedora/attributes/stream_attribute.rb', line 18 def initialize(field, args = {}) super self.delegate_target = args.fetch(:delegate_target) self.target_class = args.fetch(:klass) self.at = args.fetch(:at, nil) end |
Instance Attribute Details
#at ⇒ String
Returns the current value of at.
9 10 11 |
# File 'lib/active_fedora/attributes/stream_attribute.rb', line 9 def at @at end |
#delegate_target ⇒ String
Returns the current value of delegate_target.
9 10 11 |
# File 'lib/active_fedora/attributes/stream_attribute.rb', line 9 def delegate_target @delegate_target end |
#target_class ⇒ String
Returns the current value of target_class.
9 10 11 |
# File 'lib/active_fedora/attributes/stream_attribute.rb', line 9 def target_class @target_class end |
Instance Method Details
#primary_solr_name ⇒ Object
Gives the primary solr name for a column. If there is more than one indexer on the field definition, it gives the first
26 27 28 29 30 |
# File 'lib/active_fedora/attributes/stream_attribute.rb', line 26 def primary_solr_name @datastream ||= target_class.new raise NoMethodError, "the file '#{target_class}' doesn't respond to 'primary_solr_name'" unless @datastream.respond_to?(:primary_solr_name) @datastream.primary_solr_name(field, delegate_target) end |
#type ⇒ Object
32 33 34 35 |
# File 'lib/active_fedora/attributes/stream_attribute.rb', line 32 def type raise NoMethodError, "the file '#{target_class}' doesn't respond to 'type'" unless target_class.respond_to?(:type) target_class.type(field) end |