Skip to content

Commit

Permalink
Change CLI#run to more declarative CLI#prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
jaronson committed Nov 20, 2017
1 parent e1f7db1 commit 2e0cdfd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/calculator
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

require_relative '../lib/cli'

CLI.new.run
CLI.new.prompt
4 changes: 2 additions & 2 deletions lib/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ def initialize
@calculator = Calculator.new
end

def run
def prompt
print_cursor
handle_input(gets.chomp.strip)
run
rescue Calculator::UnrecognizedInputError
puts "Unrecognized input '#{input}'"
run
prompt
rescue StandardError
puts 'Exiting'
exit
Expand Down

0 comments on commit 2e0cdfd

Please sign in to comment.