Method: Cisco::CommandReference.key_match

Defined in:
lib/cisco_node_utils/command_reference.rb

.key_match(key, platform, product_id, cli) ⇒ Object



344
345
346
347
348
349
350
351
352
353
354
# File 'lib/cisco_node_utils/command_reference.rb', line 344

def self.key_match(key, platform, product_id, cli)
  if key[0] == '/' && key[-1] == '/'
    # It's a product-id regexp. Does it match our given product_id?
    return Regexp.new(key[1..-2]) =~ product_id ? true : false
  elsif KNOWN_FILTERS.include?(key)
    return false if key.match(/cli/) && !cli
    return Regexp.new(platform.to_s) =~ key ? true : false
  else
    return :unknown
  end
end