Sha256: f18e08f2ebd961b15703dbbcb376bcf1ea569b552b30f113117fdfa352466728
Contents?: true
Size: 790 Bytes
Versions: 1
Compression:
Stored size: 790 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. undef_method :evaluate define_method :evaluate do |src, line_no, **etc| p src p 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, **etc end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cute_print-1.4.0 | lib/cute_print/core_ext/irb.rb |