Class: Gisele::VM::Prog
- Inherits:
-
Object
- Object
- Gisele::VM::Prog
- Defined in:
- lib/gisele/vm/prog.rb
Instance Attribute Summary collapse
-
#input ⇒ Object
Returns the value of attribute input.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#pc ⇒ Object
Returns the value of attribute pc.
-
#puid ⇒ Object
Returns the value of attribute puid.
-
#root ⇒ Object
Returns the value of attribute root.
-
#waitfor ⇒ Object
Returns the value of attribute waitfor.
-
#waitlist ⇒ Object
Returns the value of attribute waitlist.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #dup ⇒ Object
-
#initialize(attrs = {}) ⇒ Prog
constructor
A new instance of Prog.
- #to_hash(keys = nil) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ Prog
Returns a new instance of Prog.
12 13 14 15 16 17 18 19 20 |
# File 'lib/gisele/vm/prog.rb', line 12 def initialize(attrs = {}) @puid = attrs[:puid] || nil @parent = attrs[:parent] || @puid @root = attrs[:root] || @puid @pc = attrs[:pc] || :main @waitfor = attrs[:waitfor] || :none @waitlist = attrs[:waitlist] || {} @input = attrs[:input] || [] end |
Instance Attribute Details
#input ⇒ Object
Returns the value of attribute input.
10 11 12 |
# File 'lib/gisele/vm/prog.rb', line 10 def input @input end |
#parent ⇒ Object
Returns the value of attribute parent.
5 6 7 |
# File 'lib/gisele/vm/prog.rb', line 5 def parent @parent end |
#pc ⇒ Object
Returns the value of attribute pc.
7 8 9 |
# File 'lib/gisele/vm/prog.rb', line 7 def pc @pc end |
#puid ⇒ Object
Returns the value of attribute puid.
4 5 6 |
# File 'lib/gisele/vm/prog.rb', line 4 def puid @puid end |
#root ⇒ Object
Returns the value of attribute root.
6 7 8 |
# File 'lib/gisele/vm/prog.rb', line 6 def root @root end |
#waitfor ⇒ Object
Returns the value of attribute waitfor.
8 9 10 |
# File 'lib/gisele/vm/prog.rb', line 8 def waitfor @waitfor end |
#waitlist ⇒ Object
Returns the value of attribute waitlist.
9 10 11 |
# File 'lib/gisele/vm/prog.rb', line 9 def waitlist @waitlist end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
52 53 54 |
# File 'lib/gisele/vm/prog.rb', line 52 def ==(other) other.is_a?(Prog) and (other.to_hash == to_hash) end |
#dup ⇒ Object
45 46 47 48 49 50 |
# File 'lib/gisele/vm/prog.rb', line 45 def dup super.tap do |c| c.waitlist = waitlist.dup c.input = input.dup end end |
#to_hash(keys = nil) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/gisele/vm/prog.rb', line 27 def to_hash(keys = nil) if keys h = {} keys.each do |k| h[k] = instance_variable_get(:"@#{k}") end h else { :puid => puid, :parent => parent, :root => root, :pc => pc, :waitfor => waitfor, :waitlist => waitlist, :input => input } end end |
#to_s ⇒ Object
57 58 59 |
# File 'lib/gisele/vm/prog.rb', line 57 def to_s "Prog(#{puid.inspect})" end |