Class: ComponentDecorator

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
app/decorators/component_decorator.rb

Instance Method Summary collapse

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

#_hObject



13
14
15
# File 'app/decorators/component_decorator.rb', line 13

def _h
  @view_context
end


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