1
0
Fork 0
mirror of https://github.com/awesome-print/awesome_print synced 2023-03-27 23:22:34 -04:00

Format ENV object as hash

This commit is contained in:
Michael Dvorkin 2013-09-21 00:29:18 -07:00
parent 79a11bc33d
commit 6a820e1f73
2 changed files with 7 additions and 0 deletions

View file

@ -63,6 +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)
else
colorize(object.inspect.to_s, type)
end

View file

@ -52,6 +52,11 @@ describe "AwesomePrint" do
require File.expand_path(File.dirname(__FILE__) + '/../lib/ap')
lambda { rand.ai }.should_not raise_error
end
it "format ENV as hash" do
ENV.ai(:plain => true).should == ENV.to_hash.ai(:plain => true)
ENV.ai.should == ENV.to_hash.ai
end
end
#------------------------------------------------------------------------------