Class: Exo::Site

Inherits:
Object
  • Object
show all
Includes:
Document
Defined in:
app/models/exo/site.rb

Defined Under Namespace

Classes: UnknowHostError

Instance Method Summary collapse

Instance Method Details

#nameObject



23
24
25
26
27
28
29
# File 'app/models/exo/site.rb', line 23

def name
  unless (array = main_host.split('.')[0..-2]).empty?
    array.join(' ')
  else
    main_host
  end
end

#nest_path(path) ⇒ Object



39
40
41
# File 'app/models/exo/site.rb', line 39

def nest_path path
  File.join theme_path, path.to_s
end

#resource_name(name) ⇒ Object



43
44
45
# File 'app/models/exo/site.rb', line 43

def resource_name name
  resources.find_by slug_id: name.to_s
end

#slug_scope(scope) ⇒ Object



31
32
33
# File 'app/models/exo/site.rb', line 31

def slug_scope scope
  scope.where site_slug_id: self.slug_id
end

#url(path = nil) ⇒ Object



35
36
37
# File 'app/models/exo/site.rb', line 35

def url path=nil
  "http://#{main_host}#{path}"
end