Sha256: f7b2fb066eef82c9bf7f342896ec1cc5803ea91555b28daf68ccb003e126cff9
Contents?: true
Size: 447 Bytes
Versions: 2
Compression:
Stored size: 447 Bytes
Contents
# frozen_string_literal: true module Boxcars # used by Boxcars to run ruby code class RubyREPL def call(code:) puts "RubyREPL: #{code}".colorize(:red) output = "" IO.popen("ruby", "r+") do |io| io.puts code io.close_write output = io.read end puts "Answer: #{output}".colorize(:red, style: :bold) output end def run(command) call(code: command) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
boxcars-0.1.1 | lib/boxcars/ruby_repl.rb |
boxcars-0.1.0 | lib/boxcars/ruby_repl.rb |