Sha256: 05e37ed1fb9159c048f0462a60a4122ff9dc27fab92911b764fe4d96fc53dbd2
Contents?: true
Size: 820 Bytes
Versions: 7
Compression:
Stored size: 820 Bytes
Contents
module DataMapper module Resource class PersistenceState # a not-persisted/unmodifiable resource class Immutable < PersistenceState def get(subject, *args) unless subject.loaded?(resource) || subject.kind_of?(Associations::Relationship) raise ImmutableError, 'Immutable resource cannot be lazy loaded' end super end def set(subject, value) raise ImmutableError, 'Immutable resource cannot be modified' end def delete raise ImmutableError, 'Immutable resource cannot be deleted' end def commit self end def rollback self end end # class Immutable end # class PersistenceState end # module Resource end # module DataMapper
Version data entries
7 entries across 7 versions & 3 rubygems