Module: ActiveFedora::Datastreams::ClassMethods
- Defined in:
- lib/active_fedora/datastreams.rb
Instance Method Summary collapse
-
#has_file_datastream(*args) ⇒ Object
Specify the attributes of a file bearing datastream.
-
#has_metadata(*args) { ... } ⇒ Object
This method is used to specify the details of a datastream.
Instance Method Details
#has_file_datastream(*args) ⇒ Object
Specify the attributes of a file bearing datastream
249 250 251 252 253 254 255 256 257 258 259 260 261 |
# File 'lib/active_fedora/datastreams.rb', line 249 def has_file_datastream(*args) if args.first.is_a? String name = args.first args = args[1] || {} args[:name] = name else args = args.first || {} end spec = {:autocreate => args.fetch(:autocreate, false), :type => args.fetch(:type,ActiveFedora::Datastream), :label => args.fetch(:label,"File Datastream"), :control_group => args.fetch(:control_group,"M")} spec[:versionable] = args[:versionable] if args.has_key? :versionable ds_specs[args.fetch(:name, "content")]= spec 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)
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/active_fedora/datastreams.rb', line 224 def (*args, &block) if args.first.is_a? String name = args.first args = args[1] || {} args[:name] = name else args = args.first end spec = {:autocreate => args.fetch(:autocreate, false), :type => args[:type], :label => args.fetch(:label,""), :control_group => args[:control_group], :disseminator => args.fetch(:disseminator,""), :url => args.fetch(:url,""),:block => block} spec[:versionable] = args[:versionable] if args.has_key? :versionable ds_specs[args[:name]]= spec end |