Class: Interscript::Node::Tests

Inherits:
Interscript::Node show all
Defined in:
lib/interscript/node/tests.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data = []) ⇒ Tests

Returns a new instance of Tests.



3
4
5
# File 'lib/interscript/node/tests.rb', line 3

def initialize data=[]
  @data = data
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



2
3
4
# File 'lib/interscript/node/tests.rb', line 2

def data
  @data
end

Instance Method Details

#<<(pair) ⇒ Object



7
8
9
# File 'lib/interscript/node/tests.rb', line 7

def <<(pair)
  @data << pair
end

#==(other) ⇒ Object



17
18
19
# File 'lib/interscript/node/tests.rb', line 17

def ==(other)
  super && self.data == other.data
end

#reverseObject



11
12
13
14
15
# File 'lib/interscript/node/tests.rb', line 11

def reverse
  self.class.new(data.map do |from,to,reverse_run|
    [to, from, reverse_run == nil ? nil : !reverse_run]
  end)
end

#to_hashObject



21
22
23
24
# File 'lib/interscript/node/tests.rb', line 21

def to_hash
  { :class => self.class.to_s,
    :data => @data }
end