Sha256: b2b4dbd8c5e2121a1da6099eccafae3f6613c069a40e0e8f889136962aa4f146

Contents?: true

Size: 704 Bytes

Versions: 32

Compression:

Stored size: 704 Bytes

Contents

class InitialStateProc
  RICH = 1_000_000

  attr_accessor :balance

  include AASM
  aasm do
    state :retired
    state :selling_bad_mortgages
    initial_state Proc.new { |banker| banker.rich? ? :retired : :selling_bad_mortgages }
  end

  def initialize(balance = 0); self.balance = balance; end
  def rich?; self.balance >= RICH; end
end

class InitialStateProcMultiple
  RICH = 1_000_000

  attr_accessor :balance

  include AASM
  aasm(:left) do
    state :retired
    state :selling_bad_mortgages
    initial_state Proc.new { |banker| banker.rich? ? :retired : :selling_bad_mortgages }
  end

  def initialize(balance = 0); self.balance = balance; end
  def rich?; self.balance >= RICH; end
end

Version data entries

32 entries across 32 versions & 1 rubygems

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