Module: YPetri::Transition::Cocking

Defined in:
lib/y_petri/transition/cocking.rb

Overview

Cocking mechanics of a transition. A transition has to be cocked, before it can succesfuly #fire. (#fire! method disregards cocking.)

Instance Method Summary collapse

Instance Method Details

#cockObject Also known as: cock!

Cocks teh transition – allows #fire to succeed.



21
22
23
# File 'lib/y_petri/transition/cocking.rb', line 21

def cock
  @cocked = true
end

#cocked?Boolean

Is the transition cocked?

Returns:

  • (Boolean)


9
10
11
# File 'lib/y_petri/transition/cocking.rb', line 9

def cocked?
  @cocked
end

#uncockObject Also known as: uncock!

Sets the transition state to uncocked.



28
29
30
# File 'lib/y_petri/transition/cocking.rb', line 28

def uncock
  @cocked = false
end

#uncocked?Boolean

Negation of #cocked? method.

Returns:

  • (Boolean)


15
16
17
# File 'lib/y_petri/transition/cocking.rb', line 15

def uncocked?
  not cocked?
end