mirror of
https://github.com/awesome-print/awesome_print
synced 2023-03-27 23:22:34 -04:00
Workaround for IPAddr#==(other) bug
This commit is contained in:
parent
1e9f34b98f
commit
33026612fc
2 changed files with 9 additions and 2 deletions
|
@ -63,8 +63,8 @@ module AwesomePrint
|
|||
def awesome_self(object, type)
|
||||
if @options[:raw] && object.instance_variables.any?
|
||||
awesome_object(object)
|
||||
elsif object == ENV
|
||||
awesome_hash(object.to_hash)
|
||||
elsif object.eql?(ENV) # See https://github.com/michaeldv/awesome_print/issues/134
|
||||
awesome_hash(ENV.to_hash)
|
||||
else
|
||||
colorize(object.inspect.to_s, type)
|
||||
end
|
||||
|
|
|
@ -57,6 +57,13 @@ describe "AwesomePrint" do
|
|||
ENV.ai(:plain => true).should == ENV.to_hash.ai(:plain => true)
|
||||
ENV.ai.should == ENV.to_hash.ai
|
||||
end
|
||||
|
||||
# See https://github.com/michaeldv/awesome_print/issues/134
|
||||
it "IPAddr workaround" do
|
||||
require "ipaddr"
|
||||
ipaddr = IPAddr.new("3ffe:505:2::1")
|
||||
ipaddr.ai.should == "#<IPAddr: IPv6:3ffe:0505:0002:0000:0000:0000:0000:0001/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff>"
|
||||
end
|
||||
end
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue