Class: Exo::SitePresenter
- Inherits:
-
Object
- Object
- Exo::SitePresenter
- Defined in:
- app/presenters/exo/site_presenter.rb
Instance Attribute Summary collapse
-
#_resources ⇒ Object
Returns the value of attribute _resources.
-
#site ⇒ Object
Returns the value of attribute site.
Instance Method Summary collapse
-
#initialize(site) ⇒ SitePresenter
constructor
A new instance of SitePresenter.
- #method_missing(meth, *args, &block) ⇒ Object
- #resource(name) ⇒ Object
- #routes ⇒ Object
- #setting(name) ⇒ Object
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
#_resources ⇒ Object
Returns the value of attribute _resources.
3 4 5 |
# File 'app/presenters/exo/site_presenter.rb', line 3 def _resources @_resources end |
#site ⇒ Object
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 |
#routes ⇒ Object
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 |