Class: Exo::Site
Defined Under Namespace
Classes: UnknowHostError
Instance Method Summary collapse
- #name ⇒ Object
- #nest_path(path) ⇒ Object
- #resource_name(name) ⇒ Object
- #slug_scope(scope) ⇒ Object
- #url(path = nil) ⇒ Object
Instance Method Details
#name ⇒ Object
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 |