Class: ImplementedChain

Inherits:
Object show all
Defined in:
lib/implemented_chain.rb

Overview

This represents a chain that doesn’t contain any theory variables. All the variables have been replaced with intrinsic/real values.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(nodes, mapping) ⇒ ImplementedChain

Returns a new instance of ImplementedChain.



10
11
12
# File 'lib/implemented_chain.rb', line 10

def initialize(nodes,mapping)
  @nodes, @mapping = nodes, mapping
end

Instance Attribute Details

#mappingObject (readonly)

Returns the value of attribute mapping.



6
7
8
# File 'lib/implemented_chain.rb', line 6

def mapping
  @mapping
end

Instance Method Details

#[](index) ⇒ Object

TODO Note sure how I feel about this direct access



19
20
21
# File 'lib/implemented_chain.rb', line 19

def [](index)
  return @nodes[index]
end

#describe(tab = 0) ⇒ Object



27
28
29
# File 'lib/implemented_chain.rb', line 27

def describe(tab=0)
  return @nodes.inject('') {|total,x| total += x.describe}
end

#each(&block) ⇒ Object



14
15
16
# File 'lib/implemented_chain.rb', line 14

def each(&block)
  @nodes.each(&block)
end

#lengthObject



23
24
25
# File 'lib/implemented_chain.rb', line 23

def length
  return @nodes.length
end

#write(tab = 0) ⇒ Object



31
32
33
# File 'lib/implemented_chain.rb', line 31

def write(tab=0)
  return @nodes.inject('') {|total,x| total += x.write}
end