Method: Chef::Resource#to_h
- Defined in:
- lib/chef/resource.rb
#to_h ⇒ Object Also known as: to_hash
720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 |
# File 'lib/chef/resource.rb', line 720 def to_h # Grab all current state, then any other ivars (backcompat) result = {} self.class.state_properties.each do |p| result[p.name] = p.get(self) end safe_ivars = instance_variables.map(&:to_sym) - FORBIDDEN_IVARS safe_ivars.each do |iv| key = iv.to_s.sub(/^@/, "").to_sym next if result.key?(key) result[key] = instance_variable_get(iv) end result end |