Class: Arista::EAPI::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/arista/eapi/parser.rb,
lib/arista/eapi/parser/show.rb

Defined Under Namespace

Classes: Show

Class Method Summary collapse

Class Method Details

.parse(command, body) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/arista/eapi/parser.rb', line 4

def self.parse(command, body)
  parser_class = command.split.first.downcase.capitalize
  parser_method = command.gsub(/\s/, '_')

  parser = self.const_get(parser_class)

  if parser.respond_to?(parser_method.to_sym)
    parser.send(parser_method, body)
  else
    body
  end
rescue NameError
  body
end