Class: Chef::Resource::DscResource::ToTextHash
- Inherits:
-
Hash
- Object
- Hash
- Chef::Resource::DscResource::ToTextHash
- Defined in:
- lib/chef/resource/dsc_resource.rb
Overview
This class will check if the object responds to to_text. If it does, it will call that as opposed to inspect. This is useful for properties that hold objects such as PsCredential, where we do not want to dump the actual ivars
Instance Method Summary collapse
Instance Method Details
#to_text ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/chef/resource/dsc_resource.rb', line 31 def to_text descriptions = self.map do |(property, obj)| obj_text = if obj.respond_to?(:to_text) obj.to_text else obj.inspect end "#{property}=>#{obj_text}" end "{#{descriptions.join(', ')}}" end |