Module: Erector::Externals

Included in:
Widget
Defined in:
lib/erector/externals.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
# File 'lib/erector/externals.rb', line 3

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#render_externals(options_to_external_renderer = {}) ⇒ Object



89
90
91
92
93
94
95
# File 'lib/erector/externals.rb', line 89

def render_externals(options_to_external_renderer = {})
  output_for_externals = Erector::Output.new
  nested_widgets = output.widgets
  externalizer = ExternalRenderer.new({:classes => nested_widgets}.merge(options_to_external_renderer))
  externalizer._render(:output => output_for_externals)
  output_for_externals.to_a
end

#render_with_externals(options_to_external_renderer = {}) ⇒ Object



80
81
82
83
84
85
86
87
# File 'lib/erector/externals.rb', line 80

def render_with_externals(options_to_external_renderer = {})
  output = Erector::Output.new
  self.to_a(:output => output) # render all the externals onto this new output buffer
  nested_widgets = output.widgets.to_a
  renderer = ExternalRenderer.new({:classes => nested_widgets}.merge(options_to_external_renderer))
  externals = renderer.to_a(:output => output)
  output.to_a
end