Class: Decision
- Inherits:
-
Object
- Object
- Decision
- Defined in:
- lib/args.rb
Instance Attribute Summary collapse
-
#flow ⇒ Object
Returns the value of attribute flow.
Instance Method Summary collapse
- #add(child, arg) ⇒ Object
- #children ⇒ Object
- #chosen ⇒ Object
-
#initialize(decider, *symbols) ⇒ Decision
constructor
A new instance of Decision.
- #to_s ⇒ Object
Constructor Details
Instance Attribute Details
#flow ⇒ Object
Returns the value of attribute flow.
49 50 51 |
# File 'lib/args.rb', line 49 def flow @flow end |
Instance Method Details
#add(child, arg) ⇒ Object
71 72 73 |
# File 'lib/args.rb', line 71 def add(child, arg) @tree[child].add arg end |
#children ⇒ Object
67 68 69 |
# File 'lib/args.rb', line 67 def children @tree.values end |
#chosen ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/args.rb', line 59 def chosen vars = @flow.find(self) arr = @decider.decide(vars, @tree.keys).map { |symbol| @tree[symbol].root } arr end |
#to_s ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/args.rb', line 75 def to_s result = "branch names:" @tree.keys.each { |child| result = result + child.to_s + " " } result += "\nbranches are of classes:" @tree.keys.each { |child| result = result + @tree[child].class.to_s + " " } result end |