bin/check-subnet-ip-consumption.rb
# Returns the value of the Name tag (if there is one) or "<no name>" (if there is not). Used with VPC and subnet objects.
Returns the value of the Name tag (if there is one) or "" (if there is not). Used with VPC and subnet objects.
Returns the value of the Name tag ( if there is one ) or " " ( if there is not ) . Used with VPC and subnet objects .
def extract_name_tag(tags)
    name_tag = tags.find { |tag| tag.key == 'Name' }
    if name_tag
      !name_tag[:value].empty? ? name_tag[:value] : '<no name>'
    else
      '<no name>'
    end
  end
def extract_name_tag ( tags ) name_tag = tags . find { | tag | tag . key == 'Name' } if name_tag ! name_tag [ :value ] . empty? ? name_tag [ :value ] : '<no name>' else '<no name>' end end
Returns the value of the Name tag (if there is one) or "<no name>" (if there is not).
Returns the value of the Name tag ( if there is one ) or " <no name > " ( if there is not ) .
# Find the 'Name' key in the tags object and extract it. If the key isn't found, we get nil instead. # If extracting the key/value was successful... # ...extract the value (if there is one), or return <no name> # Otherwise, there's not a Name key, and thus the object has no name.
tags