sapling.rb: Rubocop and refactor updates
- Fix several rubocop violations - Update functionality to account for gardner refactor
This commit is contained in:
parent
321ce557d8
commit
8700f307a7
1 changed files with 7 additions and 6 deletions
|
@ -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!'
|
||||
|
|
Loading…
Reference in a new issue