class Rubyipmi::Ipmitool::FruData

Public Class Methods

new(data) click to toggle source
# File lib/rubyipmi/ipmitool/commands/fru.rb, line 99
def initialize(data)
  parse(data)
end

Public Instance Methods

name() click to toggle source
# File lib/rubyipmi/ipmitool/commands/fru.rb, line 95
def name
  self[:name]
end
parse(data) click to toggle source

parse the fru information that should be an array of lines

# File lib/rubyipmi/ipmitool/commands/fru.rb, line 104
def parse(data)
  return unless data
  data.each do |line|
    key, value = line.split(':', 2)
    if key =~ /^FRU\s+Device.*/
      if value =~ /([\w\s]*)\(.*\)/
        self[:name] = $~[1].strip.gsub(/\ /, '_').downcase
      end
    else
      key = key.strip.gsub(/\ /, '_').downcase
      self[key] = value.strip unless value.nil?
    end
  end
end

Private Instance Methods

method_missing(method, *_args, &_block) click to toggle source
# File lib/rubyipmi/ipmitool/commands/fru.rb, line 121
def method_missing(method, *_args, &_block)
  fetch(method.to_s, nil)
end