Sha256: be002381a8ba7dafc23a448d0b1dd9ec2c86ace4aadddab0680031ec100de1d5

Contents?: true

Size: 909 Bytes

Versions: 16

Compression:

Stored size: 909 Bytes

Contents

module AASM
  module Persistence
    module PlainPersistence

      # may be overwritten by persistence mixins
      def aasm_read_state(name=:default)
        # all the following lines behave like @current_state ||= aasm(name).enter_initial_state
        current = aasm(name).instance_variable_defined?("@current_state_#{name}") &&
                  aasm(name).instance_variable_get("@current_state_#{name}")
        return current if current
        aasm(name).instance_variable_set("@current_state_#{name}", aasm(name).enter_initial_state)
      end

      # may be overwritten by persistence mixins
      def aasm_write_state(new_state, name=:default)
        true
      end

      # may be overwritten by persistence mixins
      def aasm_write_state_without_persistence(new_state, name=:default)
        aasm(name).instance_variable_set("@current_state_#{name}", new_state)
      end

    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
aasm-5.5.0 lib/aasm/persistence/plain_persistence.rb
aasm-5.4.0 lib/aasm/persistence/plain_persistence.rb
aasm-5.3.1 lib/aasm/persistence/plain_persistence.rb
aasm-5.3.0 lib/aasm/persistence/plain_persistence.rb
aasm-5.2.0 lib/aasm/persistence/plain_persistence.rb
aasm-5.1.1 lib/aasm/persistence/plain_persistence.rb
aasm-5.1.0 lib/aasm/persistence/plain_persistence.rb
aasm-5.0.8 lib/aasm/persistence/plain_persistence.rb
aasm-5.0.7 lib/aasm/persistence/plain_persistence.rb
aasm-5.0.6 lib/aasm/persistence/plain_persistence.rb
aasm-5.0.5 lib/aasm/persistence/plain_persistence.rb
aasm-5.0.4 lib/aasm/persistence/plain_persistence.rb
aasm-5.0.3 lib/aasm/persistence/plain_persistence.rb
aasm-5.0.2 lib/aasm/persistence/plain_persistence.rb
aasm-5.0.1 lib/aasm/persistence/plain_persistence.rb
aasm-5.0.0 lib/aasm/persistence/plain_persistence.rb