pry/pry — Issue #301: cat --ex should try to show a "useful" ten lines
Author: ConradIrwin
Created: 2011-10-16 03:37:29+00:00
State: open

While trying to create the wiki documentation for cat --ex I used the example of Set.new

[1] require 'set'
[2] Set.new(1)
[3] pry(main)> cat --ex 1

Exception: ArgumentError: value must be enumerable
--
From: /home/conrad/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/set.rb @ line 76 @ level: 1 of backtrace (of 3).

71: enum.nil? and return
72:
73: if block
74: enum.each { |o| add(block[o]) }
75: else
=>76: merge(enum)
77: end
78: end
79:
80: # Copy internal hash.
81: def initialize_copy(orig)

It would be awesome in cases like that if the code could shuffle the output a bit so instead I saw:

68: def initialize(enum = nil, &block) # :yields: o
69: @hash ||= Hash.new
70:
71: enum.nil? and return
72:
73: if block
74: enum.each { |o| add(block[o]) }
75: else
=>76: merge(enum)
77: end
78: end

I hacked the example in the documentation for clarity purposes to look like that.