Module: Erector::Externals
- Included in:
- Widget
- Defined in:
- lib/erector/externals.rb
Overview
Externals are a mechanism by which a widget can declare page-level resources upon which it depends. They are not emitted during the widget’s normal emiting process. Rather, the Erector::Widget::Page keeps track of all the widgets it emits, then goes back and inserts the proper tags for all the externals inside its HEAD element.
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #render_externals(options_to_external_emiter = {}) ⇒ Object
- #render_with_externals(options_to_external_emiter = {}) ⇒ Object
Class Method Details
.included(base) ⇒ Object
9 10 11 |
# File 'lib/erector/externals.rb', line 9 def self.included(base) base.extend ClassMethods end |
Instance Method Details
#render_externals(options_to_external_emiter = {}) ⇒ Object
96 97 98 99 100 101 102 |
# File 'lib/erector/externals.rb', line 96 def render_externals( = {}) output_for_externals = Erector::Output.new = output. externalizer = ExternalRenderer.new({:classes => }.merge()) externalizer._emit(:output => output_for_externals) output_for_externals.to_a end |
#render_with_externals(options_to_external_emiter = {}) ⇒ Object
86 87 88 89 90 91 92 93 94 |
# File 'lib/erector/externals.rb', line 86 def render_with_externals( = {}) output = Erector::Output.new self.to_a(:output => output) # emit all the externals onto this new output buffer = output..to_a = {:classes => }.merge() emiter = ExternalRenderer.new() externals = emiter.to_a(:output => output) output.to_a end |