Class: Exo::SitePresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/exo/site_presenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(site) ⇒ SitePresenter

Returns a new instance of SitePresenter.



5
6
7
8
# File 'app/presenters/exo/site_presenter.rb', line 5

def initialize site
  self.site = site
  self._resources = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object



24
25
26
# File 'app/presenters/exo/site_presenter.rb', line 24

def method_missing meth, *args, &block
  site.send meth.to_sym, *args, &block
end

Instance Attribute Details

#_resourcesObject

Returns the value of attribute _resources.



3
4
5
# File 'app/presenters/exo/site_presenter.rb', line 3

def _resources
  @_resources
end

#siteObject

Returns the value of attribute site.



3
4
5
# File 'app/presenters/exo/site_presenter.rb', line 3

def site
  @site
end

Instance Method Details

#resource(name) ⇒ Object



10
11
12
13
14
# File 'app/presenters/exo/site_presenter.rb', line 10

def resource name
  name = name.to_s
  _resources[name] = decorated_resource name if _resources[name] == nil
  _resources[name] || nil
end

#routesObject



20
21
22
# File 'app/presenters/exo/site_presenter.rb', line 20

def routes
  site.routes
end

#setting(name) ⇒ Object



16
17
18
# File 'app/presenters/exo/site_presenter.rb', line 16

def setting name
  self.site.settings.where(slug_id: name.to_sym).first
end