# File lib/ohai/dsl/plugin.rb, line 109 def []=(key, value) @data[key] = value end
# File lib/ohai/dsl/plugin.rb, line 119 def attribute?(name) @data.has_key?(name) end
# File lib/ohai/dsl/plugin.rb, line 113 def each(&block) @data.each do |key, value| block.call(key, value) end end
# File lib/ohai/dsl/plugin.rb, line 127 def from(cmd) status, stdout, stderr = run_command(:command => cmd) return "" if stdout.nil? || stdout.empty? stdout.strip end
Set the value equal to the stdout of the command, plus run through a regex - the first piece of match data is\ the value.
# File lib/ohai/dsl/plugin.rb, line 136 def from_with_regex(cmd, *regex_list) regex_list.flatten.each do |regex| status, stdout, stderr = run_command(:command => cmd) return "" if stdout.nil? || stdout.empty? stdout.chomp!.strip md = stdout.match(regex) return md[1] end end
# File lib/ohai/dsl/plugin.rb, line 151 def get_attribute(name) @data[name] end
# File lib/ohai/dsl/plugin.rb, line 155 def hint?(name) Ohai::Hints.hint?(name) end
# File lib/ohai/dsl/plugin.rb, line 171 def method_missing(name, *args) return get_attribute(name) if args.length == 0 set_attribute(name, *args) end
# File lib/ohai/dsl/plugin.rb, line 101 def reset! @has_run = false end
# File lib/ohai/dsl/plugin.rb, line 92 def run @has_run = true run_plugin end
emulates the old plugin loading behavior
# File lib/ohai/dsl/plugin.rb, line 160 def safe_run begin self.run rescue Ohai::Exceptions::Error => e raise e rescue => e Ohai::Log.debug("Plugin #{self.name} threw #{e.inspect}") e.backtrace.each { |line| Ohai::Log.debug( line )} end end
Generated with the Darkfish Rdoc Generator 2.