Class: ActiveFedora::Datastream
- Inherits:
-
Rubydora::Datastream
- Object
- Rubydora::Datastream
- ActiveFedora::Datastream
- Defined in:
- lib/active_fedora/datastream.rb
Overview
This class represents a Fedora datastream
Direct Known Subclasses
NomDatastream, OmDatastream, RDFDatastream, RelsExtDatastream
Instance Attribute Summary collapse
-
#digital_object ⇒ Object
writeonly
Sets the attribute digital_object.
-
#last_modified ⇒ Object
Returns the value of attribute last_modified.
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(digital_object = nil, dsid = nil, options = {}) ⇒ Datastream
constructor
A new instance of Datastream.
- #inspect ⇒ Object
-
#metadata? ⇒ boolean
abstract
Does this datastream contain metadata (not file data).
- #profile_from_hash(profile_hash) ⇒ Object
- #save ⇒ Object
-
#serialize! ⇒ Object
serializes any changed data into the content field.
-
#solrize_profile ⇒ Object
:nodoc:.
-
#to_param ⇒ Object
compatibility method for rails’ url generators.
- #to_solr(solr_doc = Hash.new) ⇒ Object
- #validate_content_present ⇒ Object
Constructor Details
#initialize(digital_object = nil, dsid = nil, options = {}) ⇒ Datastream
Returns a new instance of Datastream.
8 9 10 11 |
# File 'lib/active_fedora/datastream.rb', line 8 def initialize(digital_object=nil, dsid=nil, ={}) ## When you use the versions feature of rubydora (0.5.x), you need to have a 3 argument constructor super end |
Instance Attribute Details
#digital_object=(value) ⇒ Object (writeonly)
Sets the attribute digital_object
5 6 7 |
# File 'lib/active_fedora/datastream.rb', line 5 def digital_object=(value) @digital_object = value end |
#last_modified ⇒ Object
Returns the value of attribute last_modified.
6 7 8 |
# File 'lib/active_fedora/datastream.rb', line 6 def last_modified @last_modified end |
Instance Method Details
#create ⇒ Object
39 40 41 42 |
# File 'lib/active_fedora/datastream.rb', line 39 def create super self end |
#inspect ⇒ Object
13 14 15 |
# File 'lib/active_fedora/datastream.rb', line 13 def inspect "#<#{self.class} @pid=\"#{digital_object ? pid : nil}\" @dsid=\"#{dsid}\" @controlGroup=\"#{controlGroup}\" changed=\"#{changed?}\" @mimeType=\"#{mimeType}\" >" end |
#metadata? ⇒ boolean
Override this in your concrete datastream class.
Returns does this datastream contain metadata (not file data).
26 27 28 |
# File 'lib/active_fedora/datastream.rb', line 26 def false end |
#profile_from_hash(profile_hash) ⇒ Object
60 61 62 63 64 |
# File 'lib/active_fedora/datastream.rb', line 60 def profile_from_hash(profile_hash) profile_hash.each_pair do |key,value| profile[key] = value end end |
#save ⇒ Object
34 35 36 37 |
# File 'lib/active_fedora/datastream.rb', line 34 def save super self end |
#serialize! ⇒ Object
serializes any changed data into the content field
45 46 |
# File 'lib/active_fedora/datastream.rb', line 45 def serialize! end |
#solrize_profile ⇒ Object
:nodoc:
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/active_fedora/datastream.rb', line 48 def solrize_profile # :nodoc: profile_hash = {} profile.each_pair do |property,value| if property =~ /Date/ value = Time.parse(value) unless value.is_a?(Time) value = value.xmlschema end profile_hash[property] = value end profile_hash end |
#to_param ⇒ Object
compatibility method for rails’ url generators. This method will urlescape escape dots, which are apparently invalid characters in a dsid.
20 21 22 |
# File 'lib/active_fedora/datastream.rb', line 20 def to_param dsid.gsub(/\./, '%2e') end |
#to_solr(solr_doc = Hash.new) ⇒ Object
66 67 68 |
# File 'lib/active_fedora/datastream.rb', line 66 def to_solr(solr_doc = Hash.new) solr_doc end |
#validate_content_present ⇒ Object
30 31 32 |
# File 'lib/active_fedora/datastream.rb', line 30 def validate_content_present has_content? end |