Class: Elesai::Action::Show

Inherits:
Object
  • Object
show all
Defined in:
lib/elesai/action/show.rb

Constant Summary collapse

COMPONENTS =
%w(adapter virtualdrive vd physicaldrive pd bbu)

Instance Method Summary collapse

Constructor Details

#initialize(arguments, options) ⇒ Show

Returns a new instance of Show.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/elesai/action/show.rb', line 7

def initialize(arguments,options)

  @options = options
  @arguments = arguments

  @component = nil

  opts = OptionParser.new
  opts.banner = "Usage: #{ID} [options] show <component>"
  opts.separator ""
  opts.separator "      <component> is adapter, physicaldisk|pd, virtualdisk|vd, bbu"
  opts.order!(@arguments)

  options_valid?
  arguments_valid?
  process_arguments

  @show = { :adapter => self.method(:show_adapter),
            :virtualdrive => self.method(:show_virtualdrive),
            :physicaldrive => self.method(:show_physicaldrive),
            :bbu => self.method(:show_bbu)
  }
end

Instance Method Details

#execObject



31
32
33
34
# File 'lib/elesai/action/show.rb', line 31

def exec
  @lsi = LSI.new(:megacli => @options[:megacli], :fake => @options[:fake], :hint => @component)
  @show[@component].call
end