class Staticd::Models::Site

Public Instance Methods

to_h(*args) click to toggle source
Calls superclass method Staticd::Models::Base#to_h
# File lib/staticd/models/site.rb, line 29
def to_h(*args)
  hash = super *args
  hash["url"] = url
  hash
end
to_s() click to toggle source
# File lib/staticd/models/site.rb, line 25
def to_s
  name
end
url() click to toggle source
# File lib/staticd/models/site.rb, line 14
def url
  if domain_names.any?
    url = "http://#{domain_names.first.name}"
    public_port = Staticd::Config[:public_port]
    if public_port && public_port != "80"
      url += ":#{Staticd::Config[:public_port]}"
    end
    url
  end
end