Sha256: 920804e571397dd3cb0953d080412027e3851aa867e244e860cd27567f964e2c

Contents?: true

Size: 845 Bytes

Versions: 33

Compression:

Stored size: 845 Bytes

Contents

module ActiveFedora
  module RDF
    #
    # Mixin for adding datastream persistence to an ActiveTriples::Resource 
    # descendant so that it may be used to back an ActiveFedora::RDFDatastream.
    #
    # @see ActiveFedora::RDFDatastream.resource_class
    # @see ActiveFedora::RDF::ObjectResource
    #
    module Persistence
      extend ActiveSupport::Concern

      BASE_URI = 'info:fedora/'

      included do
        configure :base_uri => BASE_URI unless base_uri
        attr_accessor :datastream
      end

      # Overrides ActiveTriples::Resource
      def persist!
        return false unless datastream and datastream.respond_to? :save
        @persisted ||= datastream.save
      end

      # Overrides ActiveTriples::Resource
      def persisted?
        @persisted ||= (not datastream.new_record?)
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
active-fedora-9.0.8 lib/active_fedora/rdf/persistence.rb
active-fedora-9.5.0 lib/active_fedora/rdf/persistence.rb
active-fedora-9.4.3 lib/active_fedora/rdf/persistence.rb
active-fedora-9.4.2 lib/active_fedora/rdf/persistence.rb
active-fedora-9.4.1 lib/active_fedora/rdf/persistence.rb
active-fedora-9.4.0 lib/active_fedora/rdf/persistence.rb
active-fedora-9.3.0 lib/active_fedora/rdf/persistence.rb
active-fedora-9.2.1 lib/active_fedora/rdf/persistence.rb
active-fedora-9.2.0 lib/active_fedora/rdf/persistence.rb
active-fedora-9.2.0.rc2 lib/active_fedora/rdf/persistence.rb
active-fedora-9.2.0.rc1 lib/active_fedora/rdf/persistence.rb
active-fedora-9.1.2 lib/active_fedora/rdf/persistence.rb
active-fedora-9.1.1 lib/active_fedora/rdf/persistence.rb
active-fedora-9.1.0 lib/active_fedora/rdf/persistence.rb
active-fedora-9.1.0.rc1 lib/active_fedora/rdf/persistence.rb
active-fedora-9.0.6 lib/active_fedora/rdf/persistence.rb
active-fedora-9.0.5 lib/active_fedora/rdf/persistence.rb
active-fedora-9.0.4 lib/active_fedora/rdf/persistence.rb
active-fedora-9.0.3 lib/active_fedora/rdf/persistence.rb
active-fedora-9.0.2 lib/active_fedora/rdf/persistence.rb