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

Parameters:

  • args (Hash) (defaults to: {})

Options Hash (args):

  • :name (Object) — default: "content"

    The dsid of the datastream

  • :type (Object) — default: ActiveFedora::Datastream

    The class the datastream should have

  • :label (Object) — default: "File Datastream"

    The default value to put in the dsLabel field

  • :control_group (Object) — default: "M"

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



271
272
273
274
275
276
277
# File 'lib/active_fedora/datastreams.rb', line 271

def has_file_datastream(args = {})
  ds_specs[args.fetch(:name, "content")]= {
      :type => args.fetch(:type,ActiveFedora::Datastream),
      :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



258
259
260
261
262
# File 'lib/active_fedora/datastreams.rb', line 258

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