Module: Dialogue
- Defined in:
- lib/sapling/dialogue.rb
Overview
Dialogue is the module for traversing an existing tree.
Defined Under Namespace
Classes: Speaker
Class Method Summary collapse
-
.display_branch(branch, branch_no, debug = false) ⇒ Object
Format and display a branch and the options.
-
.display_trunk(trunk, debug = false) ⇒ Object
Format and display the trunk.
Class Method Details
.display_branch(branch, branch_no, debug = false) ⇒ Object
Format and display a branch and the options
23 24 25 26 27 28 29 30 31 |
# File 'lib/sapling/dialogue.rb', line 23 def self.display_branch(branch, branch_no, debug=false) puts "\n[ Branch: #{branch_no} ]" if debug puts "\n#{branch["desc"]}\n\n" branch["options"].each_pair do |k,v| puts "\t#{k}: #{v.keys[0]}" puts "\t\t[ Goes to branch #{v.values[0]} ]\n" if debug end end |
.display_trunk(trunk, debug = false) ⇒ Object
Format and display the trunk
10 11 12 13 14 15 16 |
# File 'lib/sapling/dialogue.rb', line 10 def self.display_trunk(trunk, debug=false) 40.times { print "-" } puts "\n[ Trunk ]\n" if debug puts "\n#{trunk["trunk"]}" 40.times { print "-" } puts "\n" end |