Sha256: c51dc45f93ebd1a865057b97176e3aa9fbbd527d2d9f0adbe6745da3e6f46994

Contents?: true

Size: 507 Bytes

Versions: 6

Compression:

Stored size: 507 Bytes

Contents

module ActiveFedora
  class DatastreamHash < Hash
    
    def initialize (obj)
      @obj = obj
      super()
    end

    def [] (key)
      if key == 'DC' && !has_key?(key)
        ds = Datastream.new(@obj.inner_object, key, :controlGroup=>'X')
        self[key] = ds
      end
      super
    end 

    def []= (key, val)
      @obj.inner_object.datastreams[key]=val
      super
    end 

    def freeze
      each_value do |datastream|
        datastream.freeze
      end
      super
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
active-fedora-7.0.4 lib/active_fedora/datastream_hash.rb
active-fedora-7.0.3 lib/active_fedora/datastream_hash.rb
active-fedora-7.0.2 lib/active_fedora/datastream_hash.rb
active-fedora-7.0.1 lib/active_fedora/datastream_hash.rb
active-fedora-7.0.0 lib/active_fedora/datastream_hash.rb
active-fedora-7.0.0.rc3 lib/active_fedora/datastream_hash.rb