Class: Kanrisuru::Core::IP::Parser::AddressLabel

Inherits:
Base
  • Object
show all
Defined in:
lib/kanrisuru/core/ip/parsers/address_label.rb

Class Method Summary collapse

Methods inherited from Base

ip_address_label_result_json, ip_address_label_result_parse, parse_address_info, parse_alias, parse_ip_maddr_name, parse_ip_row, parse_link, parse_rx, parse_tx, parse_valid

Class Method Details

.parse(command, action, version) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/kanrisuru/core/ip/parsers/address_label.rb', line 9

def parse(command, action, version)
  if %w[show list].include?(action)
    if version >= Kanrisuru::Core::IP::IPROUTE2_JSON_VERSION
      begin
        ip_address_label_result_json(command.to_json)
      rescue JSON::ParserError
        ip_address_label_result_parse(command.to_a)
      end
    else
      ip_address_label_result_parse(command.to_a)
    end
  end
end