Module: Expect4r::Router::Junos::Show

Included in:
J
Defined in:
lib/router/juniper/junos/show.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/router/juniper/junos/show.rb', line 13

def method_missing(name, *args, &block)
  if name.to_s =~ /^show_/
    cmd = name.to_s.split('_').join(' ') + args.join(' ')
    output = __send__ :exec, cmd, *args
  else
    super
  end
end

Instance Method Details

#show(s, arg = {}) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/router/juniper/junos/show.rb', line 5

def show(s, arg={})
  output = []
  s.each_line { |l|
    output << exec("show #{l}", arg) if l.strip.size>0
  }
  output
end