Class: Staticd::Models::Site

Inherits:
Base
  • Object
show all
Includes:
DataMapper::Resource
Defined in:
lib/staticd/models/site.rb

Instance Method Summary collapse

Methods inherited from Base

#error

Instance Method Details

#to_h(*args) ⇒ Object



29
30
31
32
33
# File 'lib/staticd/models/site.rb', line 29

def to_h(*args)
  hash = super *args
  hash["url"] = url
  hash
end

#to_sObject



25
26
27
# File 'lib/staticd/models/site.rb', line 25

def to_s
  name
end

#urlObject



14
15
16
17
18
19
20
21
22
23
# 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