mirror of
https://github.com/awesome-print/awesome_print
synced 2023-03-27 23:22:34 -04:00
Fixed incompatibility with the money gem v5
This commit is contained in:
parent
33026612fc
commit
f36e788584
2 changed files with 14 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.eql?(ENV) # See https://github.com/michaeldv/awesome_print/issues/134
|
||||
awesome_hash(ENV.to_hash)
|
||||
elsif object.respond_to?(:to_hash)
|
||||
awesome_hash(object.to_hash)
|
||||
else
|
||||
colorize(object.inspect.to_s, type)
|
||||
end
|
||||
|
|
|
@ -64,6 +64,18 @@ describe "AwesomePrint" do
|
|||
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
|
||||
|
||||
# See https://github.com/michaeldv/awesome_print/issues/139
|
||||
it "Object that overrides == and expects the :id method" do
|
||||
weird = Class.new do
|
||||
# Raises NoMethodError: undefined method `id' when "other" is nil or ENV.
|
||||
def ==(other)
|
||||
self.id == other.id
|
||||
end
|
||||
alias :eql? :==
|
||||
end
|
||||
lambda { weird.new.ai }.should_not raise_error
|
||||
end
|
||||
end
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue