mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
lib/pry.rb: keep randomness predictable!
Still a horrible hack, but at least it fixes issue https://github.com/pry/pry/issues/988 (In PRY, srand() and rand() results differs from IRB's or command line Ruby's). I also would like to mention that the `result` variable also contains some extra "\e[0m" sequences; it also messes Pry Theme up (singleton objects) a bit.
This commit is contained in:
parent
9cb54fd755
commit
235203b11f
1 changed files with 3 additions and 1 deletions
|
@ -8,6 +8,8 @@ require 'pry/exceptions'
|
|||
require 'pry/helpers/base_helpers'
|
||||
require 'pry/hooks'
|
||||
|
||||
require 'securerandom'
|
||||
|
||||
class Pry
|
||||
|
||||
# The default hooks - display messages when beginning and ending Pry sessions.
|
||||
|
@ -37,7 +39,7 @@ class Pry
|
|||
stringified = "#<#{klass}:0x#{id}>"
|
||||
end
|
||||
|
||||
nonce = rand(0x100000000).to_s(16) # whatever
|
||||
nonce = SecureRandom.hex(4)
|
||||
|
||||
stringified.gsub!(/#</, "%<#{nonce}")
|
||||
# Don't recolorize output with color (for cucumber, looksee, etc.) [Issue #751]
|
||||
|
|
Loading…
Reference in a new issue