Module: ActiveFedora::Datastreams::ClassMethods
- Defined in:
- lib/active_fedora/datastreams.rb
Instance Method Summary collapse
- #build_datastream_accessor(dsid) ⇒ Object
-
#datastream_class_for_name(dsid) ⇒ Class
The class of the datastream.
- #has_file_datastream(*args) ⇒ Object
-
#has_metadata(*args) { ... } ⇒ Object
This method is used to specify the details of a datastream.
Instance Method Details
#build_datastream_accessor(dsid) ⇒ Object
225 226 227 228 229 230 |
# File 'lib/active_fedora/datastreams.rb', line 225 def build_datastream_accessor(dsid) name = name_for_dsid(dsid) define_method name do datastreams[dsid] end end |
#datastream_class_for_name(dsid) ⇒ Class
Returns the class of the datastream.
162 163 164 |
# File 'lib/active_fedora/datastreams.rb', line 162 def datastream_class_for_name(dsid) ds_specs[dsid] ? ds_specs[dsid].fetch(:type, ActiveFedora::Datastream) : ActiveFedora::Datastream end |
#has_file_datastream(name, args) ⇒ Object #has_file_datastream(args) ⇒ Object
214 215 216 217 218 219 220 221 222 223 |
# File 'lib/active_fedora/datastreams.rb', line 214 def has_file_datastream(*args) @file_ds_defaults ||= { :autocreate => false, :type=>ActiveFedora::Datastream, :label=>"File Datastream", :control_group=>"M", :name=>"content" } spec_datastream(args, @file_ds_defaults) end |
#has_metadata(*args) { ... } ⇒ Object
This method is used to specify the details of a datastream. You can pass the name as the first argument and a hash of options as the second argument or you can pass the :name as a value in the args hash. Either way, name is required. Note that this method doesn’t actually execute the block, but stores it, to be executed by any the implementation of the datastream(specified as :type)
182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/active_fedora/datastreams.rb', line 182 def (*args, &block) @metadata_ds_defaults ||= { :autocreate => false, :type=>nil, :label=>"", :control_group=>nil, :disseminator=>"", :url=>"", :name=>nil } spec_datastream(args, @metadata_ds_defaults, &block) end |