Sha256: 9e645f138381fdd54afb43fc65aa71ed8c9427636f4370c2223bf5613e43454f

Contents?: true

Size: 1013 Bytes

Versions: 1

Compression:

Stored size: 1013 Bytes

Contents

require 'irb'

IRB.setup nil

def IRB.Output
  IRB.conf[:OUTPUT]
end

class IRB::WorkSpace
  def evaluate(context, statements, file = __FILE__, line = __LINE__)
    @after_ruby_debug_erb = false
    eval(statements, @binding, file, line)
  end

  FILTER_BACKTRACE_REGEX = /#{__FILE__}/
  def filter_backtrace backtrace
    return if @after_ruby_debug_erb
    if backtrace =~ FILTER_BACKTRACE_REGEX
      @after_ruby_debug_erb = true
      return
    else
      backtrace.sub(/:\s*in `irb_binding'/, '')
    end
  end
end

class IRB::Irb
  def output_value
    context = IRB.CurrentContext
    IRB.Output << [ :stdout, context.return_format % context.inspect_last_value ]
  end

  def print *args
    IRB.Output << [ :stderr, args.join ]
  end

  def printf format, *args
    IRB.Output << [ :stderr, format % args ]
  end
end

class StringInputMethod < StringIO
  attr_accessor :prompt
  def encoding; string.encoding end

  def gets
    line = super
    IRB.Output << [ :stdin, line ] if line
    line
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tailog-0.5.2 lib/tailog/ext/irb.rb