Sha256: 3a7c5fcd98dd27f26ef67622cf03e2cf23938a2da29622c54793e228d1e9178e

Contents?: true

Size: 911 Bytes

Versions: 10

Compression:

Stored size: 911 Bytes

Contents

module Hydra
  module Derivatives
    class Processor
      attr_accessor :object, :source_name, :directives

      def initialize(obj, source_name, directives)
        self.object = obj
        self.source_name = source_name
        self.directives = directives
      end

      def process
        raise "Processor is an abstract class. Implement `process' on #{self.class.name}"
      end

      def output_datastream_id(name)
        [source_name, name].join('_')
      end

      def output_datastream(dsid)
        # first, check for a defined datastream
        output_datastream = if object.datastreams[dsid]
          object.datastreams[dsid]
        else
          ds = ActiveFedora::Datastream.new(object.inner_object, dsid)
          object.add_datastream(ds)
          ds
        end
      end

      def source_datastream
        object.datastreams[source_name.to_s]
      end

    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
hydra-derivatives-0.1.1 lib/hydra/derivatives/processor.rb
hydra-derivatives-0.1.0 lib/hydra/derivatives/processor.rb
hydra-derivatives-0.0.8 lib/hydra/derivatives/processor.rb
hydra-derivatives-0.0.7 lib/hydra/derivatives/processor.rb
hydra-derivatives-0.0.6 lib/hydra/derivatives/processor.rb
hydra-derivatives-0.0.5 lib/hydra/derivatives/processor.rb
hydra-derivatives-0.0.4 lib/hydra/derivatives/processor.rb
hydra-derivatives-0.0.3 lib/hydra/derivatives/processor.rb
hydra-derivatives-0.0.2 lib/hydra/derivatives/processor.rb
hydra-derivatives-0.0.1 lib/hydra/derivatives/processor.rb