diff options
author | sersut <serdar@opscode.com> | 2014-01-14 16:46:16 -0800 |
---|---|---|
committer | sersut <serdar@opscode.com> | 2014-01-14 16:46:16 -0800 |
commit | a950e9ea474710185fc3d68866c0ebf1660070a6 (patch) | |
tree | a4f58e4f63d410930a503c57c65c805968d42786 /lib/ohai/system.rb | |
parent | d887bb350da5c8832849fe24ae194dc40463e698 (diff) | |
download | ohai-a950e9ea474710185fc3d68866c0ebf1660070a6.tar.gz |
Move constant clean up functions to its own mixin.
Diffstat (limited to 'lib/ohai/system.rb')
-rw-r--r-- | lib/ohai/system.rb | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/lib/ohai/system.rb b/lib/ohai/system.rb index f5414cf8..f844504c 100644 --- a/lib/ohai/system.rb +++ b/lib/ohai/system.rb @@ -24,6 +24,7 @@ require 'ohai/dsl' require 'ohai/mixin/command' require 'ohai/mixin/os' require 'ohai/mixin/string' +require 'ohai/mixin/constant_helper' require 'ohai/provides_map' require 'ohai/hints' require 'mixlib/shellout' @@ -31,8 +32,9 @@ require 'mixlib/shellout' require 'yajl' module Ohai - class System + include Ohai::Mixin::ConstantHelper + attr_accessor :data attr_reader :provides_map attr_reader :v6_dependency_solver @@ -189,24 +191,5 @@ module Ohai raise ArgumentError, "I can only generate JSON for Hashes, Mashes, Arrays and Strings. You fed me a #{data.class}!" end end - - private - def recursive_remove_constants(object) - if object.respond_to?(:constants) - object.constants.each do |const| - next unless strict_const_defined?(object, const) - recursive_remove_constants(object.const_get(const)) - object.send(:remove_const, const) - end - end - end - - def strict_const_defined?(object, const) - if object.method(:const_defined?).arity == 1 - object.const_defined?(const) - else - object.const_defined?(const, false) - end - end end end |