Class: ActionView::PathHints

Inherits:
Object
  • Object
show all
Defined in:
lib/actionview/path_hints.rb

Constant Summary collapse

CONTAINER =
%w(
  position:relative
  border:1px\ solid\ %s
)
LABEL =
%w(
  font-size:9px
  background:beige
  position:absolute
  top:0
  left:0
)

Instance Method Summary collapse

Constructor Details

#initialize(view, template) ⇒ PathHints

Returns a new instance of PathHints.



14
15
16
17
# File 'lib/actionview/path_hints.rb', line 14

def initialize(view, template)
  @view = view
  @template = template
end

Instance Method Details

#apply(output_buffer) ⇒ Object



19
20
21
22
# File 'lib/actionview/path_hints.rb', line 19

def apply(output_buffer)
  output_buffer.prepend("<div style='#{styles(sprintf(CONTAINER, cached? ? 'green' : 'red'))}'>"\
"<span style='#{styles(LABEL)}'>#{@template.inspect}</span>".html_safe).concat('</div>'.html_safe)
end