Sha256: b2d57ed23fcc4097252eea3fb9f5683849c0d1c44bcf9df457faeb87da14d5a2

Contents?: true

Size: 603 Bytes

Versions: 5

Compression:

Stored size: 603 Bytes

Contents

# -*- coding: utf-8 -*-

# Cocking mechanics of a transition. A transition has to be cocked, before
# it can succesfuly +#fire+. (+#fire!+ method disregards cocking.)
# 
class YPetri::Transition
  # Is the transition cocked?
  # 
  def cocked?
    @cocked
  end

  # Negation of +#cocked?+ method.
  # 
  def uncocked?
    not cocked?
  end

  # Cocks teh transition -- allows +#fire+ to succeed.
  # 
  def cock
    @cocked = true
  end
  alias :cock! :cock

  # Sets the transition state to uncocked.
  # 
  def uncock
    @cocked = false
  end
  alias :uncock! :uncock
end # class YPetri::Transition

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
y_petri-2.1.3 lib/y_petri/transition/cocking.rb
y_petri-2.0.15 lib/y_petri/transition/cocking.rb
y_petri-2.0.14.p1 lib/y_petri/transition/cocking.rb
y_petri-2.0.14 lib/y_petri/transition/cocking.rb
y_petri-2.0.7 lib/y_petri/transition/cocking.rb