app/models/manageiq/providers/google/inventory/parser/network_manager.rb
# Parses a port range returned by GCP from a string to a Range. Note that
# GCP treats the empty port range "" to mean all ports; hence this method
# returns 0..65535 when the input is the empty string.
#
# @param port_range [String] the port range (e.g. "" or "80-123" or "11")
# @return [Range] a range representing the port range
Parses a port range returned by GCP from a string to a Range. Note that
GCP treats the empty port range "" to mean all ports; hence this method
returns 0..65535 when the input is the empty string.
Parses a port range returned by GCP from a string to a Range . Note that GCP treats the empty port range " " to mean all ports ; hence this method returns 0 .. 65535 when the input is the empty string .
def parse_port_range(port_range)
    m = /\A(\d+)(?:-(\d+))?\Z/.match(port_range)
    return 0..65_535 unless m
    start = Integer(m[1])
    finish = m[2] ? Integer(m[2]) : start
    start..finish
  end
def parse_port_range ( port_range ) m = / \A ( \d +)(?:-( \d +))? \Z / . match ( port_range ) return 0 .. 65_535 unless m start = Integer ( m [ 1 ] ) finish = m [ 2 ] ? Integer ( m [ 2 ] ) : start start .. finish end
Parses a port range returned by GCP from a string to a Range.
Parses a port range returned by GCP from a string to a Range .
# Three forms: # "80" # "5000-5010" # "" (all ports)
a range representing the port range
a range representing the port range
Range
port_range
the port range
the port range