Sha256: 3f8165bd03430e15ce274064662a4a1515426e53c88ba7a98e1965d4284b5c22

Contents?: true

Size: 658 Bytes

Versions: 7

Compression:

Stored size: 658 Bytes

Contents

module DataMapper
  module Resource
    class PersistenceState

      # a persisted resource (abstract)
      class Persisted < PersistenceState
        def get(subject, *args)
          lazy_load(subject)
          super
        end

      private

        def repository
          @repository ||= resource.instance_variable_get(:@_repository)
        end

        def collection_for_self
          @collection_for_self ||= resource.collection_for_self
        end

        def lazy_load(subject)
          subject.lazy_load(resource)
        end

      end # class Persisted
    end # class PersistenceState
  end # module Resource
end # module DataMapper

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
ardm-core-1.3.0 lib/dm-core/resource/persistence_state/persisted.rb
ardm-core-1.2.1 lib/dm-core/resource/persistence_state/persisted.rb
dm-core-1.2.1 lib/dm-core/resource/persistence_state/persisted.rb
ghost_dm-core-1.3.0.beta lib/dm-core/resource/persistence_state/persisted.rb
dm-core-1.2.0 lib/dm-core/resource/persistence_state/persisted.rb
dm-core-1.2.0.rc2 lib/dm-core/resource/persistence_state/persisted.rb
dm-core-1.2.0.rc1 lib/dm-core/resource/persistence_state/persisted.rb