From 8700f307a7d1efd5d0bff0ab96b16385fd8bb10b Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Wed, 18 Oct 2017 23:46:00 -0400 Subject: [PATCH] sapling.rb: Rubocop and refactor updates - Fix several rubocop violations - Update functionality to account for gardner refactor --- lib/sapling.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/sapling.rb b/lib/sapling.rb index 2025207..eef7142 100644 --- a/lib/sapling.rb +++ b/lib/sapling.rb @@ -8,19 +8,20 @@ Dir[File.join(__dir__, 'sapling', '*.rb')].each { |file| require file } # The main Sapling interface. class Sapling < Thor desc 'read TREE', 'Load and traverse the TREE' - def read(tree) - exit unless verify_tree(tree) + def read(file) puts 'Welcome to Sapling, a Dialogue Tree Utility.' - speaker = Dialogue::Speaker.new(YAML.load_file(tree), false) + exit unless verify_tree(file) + tree = Gardner::Plot.new(YAML.load_file(file), false) + speaker = Dialogue::Speaker.new(tree) speaker.conversation end desc 'edit TREE', 'Edit a new or existing TREE' - def edit(tree = '') + def edit(file = '') puts 'Welcome to Sapling, a Dialogue Tree Utility.' if !tree.empty? - puts "Loading tree: #{tree}" - exit unless verify_tree(tree) + puts "Loading tree: #{file}" + exit unless verify_tree(file) gardner = Planter::Spade.new(YAML.load_file(tree, false)) else puts 'Creating a new tree!'