Sha256: f65927e398fcb9eb3924fa4b492c28387e12d8fd430a8f7e4e7c8f06686a0e6a

Contents?: true

Size: 890 Bytes

Versions: 2

Compression:

Stored size: 890 Bytes

Contents

# encoding: utf-8

module ROM
  class Session

    # @api private
    class State
      include Concord::Public.new(:object)

      TransitionError = Class.new(StandardError)

      # @api private
      def save(*)
        raise TransitionError, "cannot save object with #{self.class} state"
      end

      # @api private
      def delete(*)
        raise TransitionError, "cannot delete object with #{self.class} state"
      end

      # @api private
      def transient?
        instance_of?(Transient)
      end

      # @api private
      def created?
        instance_of?(Created)
      end

      # @api private
      def persisted?
        instance_of?(Persisted)
      end

      # @api private
      def updated?
        instance_of?(Updated)
      end

      # @api private
      def deleted?
        instance_of?(Deleted)
      end

    end # State

  end # Session
end # ROM

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rom-session-0.1.1 lib/rom/session/state.rb
rom-session-0.1.0 lib/rom/session/state.rb