Method: Fortitude::RenderingContext#record_widget

Defined in:
lib/fortitude/rendering_context.rb

#record_widget(widget) ⇒ Object



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/fortitude/rendering_context.rb', line 74

def record_widget(widget)
  start_widget!(widget)
  @current_widget_nesting << widget
  @current_element_nesting << widget
  begin
    yield
  ensure
    last = @current_widget_nesting.pop
    unless last.equal?(widget)
      raise "Something horrible happened -- the last widget we started was #{last}, but now we're ending #{widget}?!?"
    end
    last = @current_element_nesting.pop
    unless last.equal?(widget)
      raise "Something horrible happened -- the last element we started was #{last}, but now we're ending #{widget}?!?"
    end
    end_widget!(widget)
  end
end