Module: ActiveFedora::Datastreams::ClassMethods

Defined in:
lib/active_fedora/datastreams.rb

Instance Method Summary collapse

Instance Method Details

#has_file_datastream(args) ⇒ Object

Specify the attributes of a file bearing datastream

Options

:name

The dsid of the datastream

:type

The class the datastream should have

:label

The default value to put in the dsLabel field

:control_group

The type of controlGroup to store the datastream as. Defaults to M



271
272
273
# File 'lib/active_fedora/datastreams.rb', line 271

def has_file_datastream(args)
  ds_specs[args.fetch(:name, "content")]= {:type => args[:type], :label =>  args.fetch(:label,"File Datastream"), :control_group => args.fetch(:control_group,"M")}
end

#has_metadata(args) { ... } ⇒ Object

This method is used to specify the details of a datastream. args must include :name. Note that this method doesn’t actually execute the block, but stores it at the class level, to be executed by any future instantiations.

Parameters:

Options Hash (args):

  • :type (Class)

    The class that will represent this datastream, should extend “Datastream”

  • :name (String)

    the handle to refer to this datastream as

  • :label (String)

    sets the fedora label

  • :control_group (String) — default: 'X'

    must be one of ‘E’, ‘X’, ‘M’, ‘R’

  • :disseminator (String)
  • :url (String)
  • :versionable (Boolean) — default: true

    Should versioned datastreams be stored

Yields:

  • block executed by some kinds of datastreams



254
255
256
257
258
# File 'lib/active_fedora/datastreams.rb', line 254

def (args, &block)
  spec = {:type => args[:type], :label =>  args.fetch(:label,""), :control_group => args.fetch(:control_group,"X"), :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