Method: URI::HTTP#subdominate

Defined in:
lib/mumukit/platform/uri.rb

#subdominate(subdomain, **options) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/mumukit/platform/uri.rb', line 2

def subdominate(subdomain, **options)
  if host.start_with? 'www.'
    new_host = host.gsub('www.', "www.#{subdomain}.")
  else
    new_host = "#{subdomain}.#{host}"
  end
  rebuild({host: new_host}, **options)
end