diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-08-11 17:36:52 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2014-08-11 17:36:52 -0700 |
commit | 3f415b11dfb1c494a45a0a83d69196cd75924cf1 (patch) | |
tree | ee6bbff8836a1a8514fe3be7ce9ead67ad8cb02a /lib/chef/resource_collection.rb | |
parent | b4dfc6a1f478f29105a3b4746029e3ad46291b82 (diff) | |
download | chef-3f415b11dfb1c494a45a0a83d69196cd75924cf1.tar.gz |
remove JSON gem usage
should fully convert to using ffi-yajl
there are still issues with JSON gem monkeypatching interacting with
chef-zero and the spec tests so we keep the requires here for the
json gem and the ffi_yajl/json_gem here. when ohai and chef-zero are
fixed, we an just require ffi_yajl.
Diffstat (limited to 'lib/chef/resource_collection.rb')
-rw-r--r-- | lib/chef/resource_collection.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/chef/resource_collection.rb b/lib/chef/resource_collection.rb index a528a18aed..2cbd61cb0c 100644 --- a/lib/chef/resource_collection.rb +++ b/lib/chef/resource_collection.rb @@ -158,7 +158,6 @@ class Chef # compat. alias_method :resources, :find - # Returns true if +query_object+ is a valid string for looking up a # resource, or raises InvalidResourceSpecification if not. # === Arguments @@ -189,16 +188,19 @@ class Chef end # Serialize this object as a hash - def to_json(*a) + def to_hash instance_vars = Hash.new self.instance_variables.each do |iv| instance_vars[iv] = self.instance_variable_get(iv) end - results = { + { 'json_class' => self.class.name, 'instance_vars' => instance_vars } - results.to_json(*a) + end + + def to_json(*a) + Chef::JSONCompat.to_json(to_hash, *a) end def self.json_create(o) |