Sha256: e43f819838e13da3c73bfd244a5488c40a623d8682953b1c5db5114e7696fb75

Contents?: true

Size: 863 Bytes

Versions: 32

Compression:

Stored size: 863 Bytes

Contents

module Callbacks
  class PrivateMethodMultiple
    include AASM

    def initialize(options={})
      @fail_event_guard = options[:fail_event_guard]
      @fail_transition_guard = options[:fail_transition_guard]
      @log = options[:log]
      reset_data
    end

    def reset_data
      @data = []
    end

    def data
      @data.join(' ')
    end

    aasm(:left) do
      state :open, :initial => true
      state :closed

      event :close, :after => :after_event do
        transitions :to => :closed, :from => [:open]
      end

      event :open, :after => :after_event do
        transitions :to => :open, :from => :closed
      end
    end

    def log(text)
      @data << text
      puts text if @log
    end

    def aasm_write_state(*args); log('aasm_write_state'); true; end

    private

    def after_event; log('after_event'); end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
aasm-5.3.1 spec/models/callbacks/private_method_multiple.rb
aasm-5.3.0 spec/models/callbacks/private_method_multiple.rb
aasm-5.2.0 spec/models/callbacks/private_method_multiple.rb
aasm-5.1.1 spec/models/callbacks/private_method_multiple.rb
aasm-5.1.0 spec/models/callbacks/private_method_multiple.rb
aasm-5.0.8 spec/models/callbacks/private_method_multiple.rb
aasm-5.0.7 spec/models/callbacks/private_method_multiple.rb
aasm-5.0.6 spec/models/callbacks/private_method_multiple.rb
aasm-5.0.5 spec/models/callbacks/private_method_multiple.rb
aasm-5.0.4 spec/models/callbacks/private_method_multiple.rb
aasm-5.0.3 spec/models/callbacks/private_method_multiple.rb
aasm-5.0.2 spec/models/callbacks/private_method_multiple.rb
aasm-5.0.1 spec/models/callbacks/private_method_multiple.rb
aasm-5.0.0 spec/models/callbacks/private_method_multiple.rb
aasm-4.12.3 spec/models/callbacks/private_method_multiple.rb
aasm-4.12.2 spec/models/callbacks/private_method_multiple.rb
aasm-4.12.1 spec/models/callbacks/private_method_multiple.rb
aasm-4.12.0 spec/models/callbacks/private_method_multiple.rb
aasm-4.11.1 spec/models/callbacks/private_method_multiple.rb
aasm-4.11.0 spec/models/callbacks/private_method_multiple.rb