class Lpar_IO_slot

Attributes

data_string_raw[R]
is_required[RW]
slot_DRC_index[RW]
slot_IO_pool_ID[RW]

Public Class Methods

new(string) click to toggle source
# File lib/HMC/Lpar_IO_slot.rb, line 11
def initialize(string)
  @slot_DRC_index = nil
  @slot_IO_pool_ID = 'none'
  @is_required = 0
  @data_string_raw = nil

  parse(string) unless string.empty?
end

Public Instance Methods

parse(string) click to toggle source
# File lib/HMC/Lpar_IO_slot.rb, line 20
def parse(string)
  @data_string_raw = string

  regexp = %r{^\s*(\w+)\/(none|d+)\/([01])\s*$}

  if match = regexp.match(string)
    @slot_DRC_index = match[1]
    @slot_IO_pool_ID = match[2]
    @is_required = match[3].to_i
  else
    pp string
    pp regexp
    pp match
    raise 'wrong string to parse'
  end
end
to_s() click to toggle source
# File lib/HMC/Lpar_IO_slot.rb, line 37
def to_s
  "#{@slot_DRC_index}/#{@slot_IO_pool_ID}/#{is_required}"
end