class Odmget
Attributes
data[R]
data_string_raw[R]
Public Class Methods
new(string)
click to toggle source
# File lib/AIX/odmget.rb, line 8 def initialize(string) @data = Array.new @data_string_raw='' @odm_supported_class = %w(SRCsubsys) if string.length > 0 @data_string_raw = string self.parse(string) end end
Public Instance Methods
parse(string)
click to toggle source
# File lib/AIX/odmget.rb, line 21 def parse(string) entry = '' entry_title = '' string.split("\n").each do |line| if match = %r{^(\w+):\s*$}.match(line) self.parse_entry(entry_title, entry) if entry_title.length > 2 #let's ignore first run # let's create new entry entry_title = match[1] entry = line + "\n" else entry += line + "\n" end end self.parse_entry(entry_title, entry) if entry_title.length > 2 # last run and exlcude case that file (string) is empty end
parse_entry(odm_class, entry)
click to toggle source
# File lib/AIX/odmget.rb, line 44 def parse_entry(odm_class, entry) raise "Unsuported ODM class '#{odm_class}'" unless @odm_supported_class.include?(odm_class) object = case odm_class when 'SRCsubsys' then Odmget_SRCsubsys.new(entry) else raise "Unsuported ODM class '#{odm_class}'<" end @data.push(object) end