lib/boxcars/ruby_repl.rb in boxcars-0.1.1 vs lib/boxcars/ruby_repl.rb in boxcars-0.1.2

- old
+ new

@@ -1,10 +1,12 @@ # frozen_string_literal: true module Boxcars # used by Boxcars to run ruby code class RubyREPL + # Execute ruby code + # @param code [String] The code to run def call(code:) puts "RubyREPL: #{code}".colorize(:red) output = "" IO.popen("ruby", "r+") do |io| io.puts code @@ -13,9 +15,11 @@ end puts "Answer: #{output}".colorize(:red, style: :bold) output end + # Execute ruby code + # @param command [String] The code to run def run(command) call(code: command) end end end