summaryrefslogtreecommitdiffstats
path: root/lib/puppet/resource.rb
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2011-01-03 16:28:24 -0800
committerJesse Wolfe <jes5199@gmail.com>2011-01-03 16:28:24 -0800
commit7661ba82a3c765d4bf8a400a3c770f351c541f96 (patch)
tree89e9736c4357dd17ef6bc128af11890a5f93a64e /lib/puppet/resource.rb
parent10f89de6e55429fcb055b15a513d01e6e20f03b9 (diff)
downloadpuppet-7661ba82a3c765d4bf8a400a3c770f351c541f96.tar.gz
puppet-7661ba82a3c765d4bf8a400a3c770f351c541f96.tar.xz
puppet-7661ba82a3c765d4bf8a400a3c770f351c541f96.zip
maint: Prune #inspect methods on various objects
Ruby's default #inspect method can lead to printing factorial-order output for large graphs of objects. Since we have large graphs of objects, this is not optimal. This patch replaces a few well-connected objects' #inspect methods with methods that produce reduced output, and are thus much faster. Paired-With: Nick Lewis <nick@puppetlabs.com>
Diffstat (limited to 'lib/puppet/resource.rb')
-rw-r--r--lib/puppet/resource.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/puppet/resource.rb b/lib/puppet/resource.rb
index 4f0d50750..b0a3ecee6 100644
--- a/lib/puppet/resource.rb
+++ b/lib/puppet/resource.rb
@@ -46,6 +46,10 @@ class Puppet::Resource
resource
end
+ def inspect
+ "#{@type}[#{@title}]#{to_hash.inspect}"
+ end
+
def to_pson_data_hash
data = ([:type, :title, :tags] + ATTRIBUTES).inject({}) do |hash, param|
next hash unless value = self.send(param)