class Chef::Resource::DscResource::ToTextHash

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

Public Instance Methods

to_text() click to toggle source
# File lib/chef/resource/dsc_resource.rb, line 38
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