def map(value)
      if value.respond_to?(:map)
        value.map { |e| map_scalar(e) }
      else
        map_scalar(value)
      end
    end
def map(value)
      if value.respond_to?(:map)
        value.map { |e| map_scalar(e) }
      else
        map_scalar(value)
      end
    end
Create an instance of Mapper

 @param [Docker::Compose::Session] session
 @param [NetInfo] net_info
 Substitute service hostnames and ports that appear in a URL or a
 host:port string. If either component of a host:port string is
 surrounded by square brackets, "elide" that component, removing it
 from the result but using it to find the correct service and port.

 @example map MySQL on local docker host with 3306 published to 13847
   map("tcp://db:3306") # => "tcp://127.0.0.1:13847"

 @example map just the hostname of MySQL on local docker host
   map("db:[3306]") # => "127.0.0.1"

 @example map just the port of MySQL on local docker host
   map("[db]:3306") # => "13847"

 @example map an array of database hosts
   map(["[db1]:3306", "[db2]:3306"])

 @param [String,#map] value a URI, host:port pair, or an array of either

 @return [String,Array] the mapped value with container-names and ports substituted

 @raise [BadSubstitution] if a substitution string can't be parsed
 @raise [NoService] if service is not up or does not publish port