Method: Kanrisuru::Core::IP#ip_route

Defined in:
lib/kanrisuru/core/ip/commands/route.rb

#ip_route(action, opts) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/kanrisuru/core/ip/commands/route.rb', line 6

def ip_route(action, opts)
  case action
  when 'show', 'list'
    version = ip_version.to_i
    command = ip_route_show(opts, version)
  when 'flush'
    command = ip_route_flush(opts)
  when 'add', 'change', 'append', 'del', 'delete', 'replace'
    command = ip_route_modify(action, opts)
  when 'get'
    command = ip_route_get(opts)
  end

  execute_shell(command)

  Kanrisuru::Result.new(command) do |cmd|
    Parser::Route.parse(cmd, action, version)
  end
end