Class: Sapling
- Inherits:
-
Thor
- Object
- Thor
- Sapling
- Defined in:
- lib/sapling.rb
Overview
The main Sapling interface.
Instance Method Summary collapse
Instance Method Details
#edit(file = '') ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/sapling.rb', line 20 def edit(file = '') puts 'Welcome to Sapling, a Dialogue Tree Utility.' if !tree.empty? puts "Loading tree: #{file}" exit unless verify_tree(file) gardner = Planter::Spade.new(YAML.load_file(tree, false)) else puts 'Creating a new tree!' gardner = Planter::Spade.new(SKELETON_TREE) end gardner.plant end |
#export(tree) ⇒ Object
40 41 42 43 |
# File 'lib/sapling.rb', line 40 def export(tree) exit unless verify_tree(tree) puts 'Cool feature, bro!' end |
#read(file) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/sapling.rb', line 11 def read(file) puts 'Welcome to Sapling, a Dialogue Tree Utility.' exit unless verify_tree(file) tree = Gardner::Plot.new(YAML.load_file(file)) speaker = Dialogue::Speaker.new(tree, false) speaker.conversation end |
#serve(tree) ⇒ Object
34 35 36 37 |
# File 'lib/sapling.rb', line 34 def serve(tree) exit unless verify_tree(tree) puts 'Sinatra will be cool.' end |