Sha256: fb30d166e122a9d5add9e5a04d58ae6c026b09928d02b52f8a3cc1ccee40582b
Contents?: true
Size: 715 Bytes
Versions: 6
Compression:
Stored size: 715 Bytes
Contents
# Taken and then # modified from the _wrong_ gem: # https://github.com/sconover/wrong/blob/30475fc5ac9d0f73135d229b1b44c045156a7e7a/lib/wrong/irb.rb # Thanks for showing the way if defined? IRB module IRB class Context def all_lines @all_lines.join end original_evaluate = instance_method(:evaluate) # Save every line that is evaluated. This gives cute_print a # way to get the source when it is run in irb. define_method :evaluate do |src, line_no| @all_lines ||= [] @all_lines += ["\n"] * (line_no - @all_lines.size - 1) @all_lines += src.lines.to_a original_evaluate.bind(self).call src, line_no end end end end
Version data entries
6 entries across 6 versions & 1 rubygems