Class: LVM::Wrapper::PVSSEG

Inherits:
Object
  • Object
show all
Includes:
Reporting
Defined in:
lib/lvm/wrapper/pvsseg.rb

Overview

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

Constant Summary collapse

BASE_COMMAND =
"pvs #{Reporting::BASE_ARGUMENTS}"
ATTRIBUTES_FILE =
"pvsseg.yaml"

Constants included from Reporting::Constants

Reporting::Constants::BASE_ARGUMENTS, Reporting::Constants::EMPTY, Reporting::Constants::SEPERATOR

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Reporting

build_command, process_line

Constructor Details

#initialize(options) ⇒ PVSSEG

Returns a new instance of PVSSEG.



13
14
15
16
# 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

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



10
11
12
# File 'lib/lvm/wrapper/pvsseg.rb', line 10

def attributes
  @attributes
end

#commandObject (readonly)

Returns the value of attribute command.



11
12
13
# File 'lib/lvm/wrapper/pvsseg.rb', line 11

def command
  @command
end

Instance Method Details

#listObject



21
22
23
24
25
26
27
28
29
# 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