lib/volt/cli/console.rb in volt-0.9.3.pre2 vs lib/volt/cli/console.rb in volt-0.9.3.pre3

- old
+ new

@@ -23,9 +23,30 @@ Volt::Computation.flush! Volt::Timers.flush_next_tick_timers! end end end + + # The following causes promises in the console to auto-resolve, making it + # easier to see your data, but harder to follow along. Currently off by + # default. + if ENV['AUTO_RESOLVE'] + def evaluate_ruby(code) + inject_sticky_locals! + exec_hook :before_eval, code, self + + result = current_binding.eval(code, Pry.eval_path, Pry.current_line) + + if result.is_a?(Promise) + result = result.sync + end + + set_last_result(result, code) + ensure + update_input_history(code) + exec_hook :after_eval, result, self + end + end end module Volt class Console module Helpers