Method: Cisco::RouteMap#match_metric

Defined in:
lib/cisco_node_utils/route_map.rb

#match_metricObject

match metric 1 8 224 - 9 23 5 - 8 6



847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
# File 'lib/cisco_node_utils/route_map.rb', line 847

def match_metric
  str = config_get('route_map', 'match_metric', @get_args)
  return default_match_metric if str.empty?
  rarr = []
  larr = []
  metrics = str.split
  deviation = false
  metrics.each do |metric|
    deviation = true if metric == '+-'
    if !larr.empty? && !deviation
      larr << '0'
      rarr << larr
      larr = []
    end
    next if metric == '+-'
    if !larr.empty? && deviation
      larr << metric
      rarr << larr
      larr = []
      deviation = false
      next
    end
    larr << metric if larr.empty?
  end
  unless larr.empty?
    larr << '0'
    rarr << larr
  end
  rarr
end