Class: ComponentDecorator
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- ComponentDecorator
- Defined in:
- app/decorators/component_decorator.rb
Instance Method Summary collapse
- #_h ⇒ Object
-
#initialize(component, view_context) ⇒ ComponentDecorator
constructor
A new instance of ComponentDecorator.
- #resource_link(args = {}) ⇒ Object
Constructor Details
#initialize(component, view_context) ⇒ ComponentDecorator
Returns a new instance of ComponentDecorator.
2 3 4 5 |
# File 'app/decorators/component_decorator.rb', line 2 def initialize(component, view_context) super(component) @view_context = view_context end |
Instance Method Details
#_h ⇒ Object
13 14 15 |
# File 'app/decorators/component_decorator.rb', line 13 def _h @view_context end |
#resource_link(args = {}) ⇒ Object
7 8 9 10 11 |
# File 'app/decorators/component_decorator.rb', line 7 def resource_link(args={}) url = args[:url] url ||= [_h.root_url, args[:uri]].join('') _h.link_to(url, url, args[:html]) end |