class LVM::Wrapper::PVSSEG

segment output is very different in that its multi line, easier to treat as own command

Constants

ATTRIBUTES_FILE
BASE_COMMAND

Attributes

attributes[R]
command[R]

Public Class Methods

new(options) click to toggle source
# File lib/lvm/wrapper/pvsseg.rb, line 13
def initialize(options)
  @attributes = Attributes.load(options[:version], ATTRIBUTES_FILE)
  @command = "#{options[:command]} #{Reporting.build_command(attributes, BASE_COMMAND, options[:additional_arguments])}"
end

Public Instance Methods

list() { |obj| ... } click to toggle source
# File lib/lvm/wrapper/pvsseg.rb, line 21
def list
  output = External.cmd(@command)
  data = parse(output)
  if block_given?
    return data.each { |obj| yield obj }
  else
    return data
  end
end

Private Instance Methods

parse(output) { |volume| ... } click to toggle source

Parses the output of self.command

# File lib/lvm/wrapper/pvsseg.rb, line 34
def parse(output)
  volumes = []

  output.split("\n").each do |line|
    args = process_line(attributes, line)

    args[:finish] = args[:start] + args[:size]

    # finally build our object
    volume = PhysicalVolumeSegment.new(args)

    if block_given?
      yield volume
    else
      volumes << volume
    end
  end

  return volumes
end