Method: CiscoAclIntp::Scanner#scan_match_ipaddr

Defined in:
lib/cisco_acl_intp/scanner.rb

#scan_match_ipaddrBoolean (private)

Scanner of IP address

Returns:

  • (Boolean)

    if line matched IP address



107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/cisco_acl_intp/scanner.rb', line 107

def scan_match_ipaddr
  case
  when @ss.scan(/(\d+\.\d+\.\d+\.\d+)\s/)
    ## IP Address
    @line_queue.push [:IPV4_ADDR, @ss[1]]
  when @ss.scan(%r{(\d+\.\d+\.\d+\.\d+)(\/)(\d+)\s})
    ## IP Address of 'ip/mask' notation
    @line_queue.push [:IPV4_ADDR, @ss[1]]
    @line_queue.push ['/',        @ss[2]]
    @line_queue.push [:NUMBER,    @ss[3].to_i]
  end
  @ss.matched?
end