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
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/chef/resource/dsc_resource.rb', line 36 def to_text descriptions = 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 |