class MirahD::Server::Compiler

Public Instance Methods

compile(args, dir = FileUtils.pwd) click to toggle source
# File lib/mirahd/server.rb, line 8
def compile args, dir = FileUtils.pwd
  intercepting_stdout do
    FileUtils.cd dir do
      Mirah::Commands::Compile.new(args).execute
    end
  end
end

Private Instance Methods

intercepting_stdout() { || ... } click to toggle source
# File lib/mirahd/server.rb, line 18
def intercepting_stdout
  orig_stdout = $stdout
  $stdout = StringIO.new 'w'
  yield
rescue Exception => ex
  new_ex = StandardError.new $stdout.string
  new_ex.set_backtrace ex.backtrace
  raise new_ex
else
  $stdout.string
ensure
  $stdout = orig_stdout
end