Class: Hypernova::BatchRenderer
- Inherits:
-
Object
- Object
- Hypernova::BatchRenderer
- Defined in:
- lib/hypernova/batch_renderer.rb
Instance Method Summary collapse
-
#initialize(jobs) ⇒ BatchRenderer
constructor
A new instance of BatchRenderer.
-
#render(response) ⇒ Object
Example of what is returned by this method: { “DeathStarLaserComponent.js” => “<h1>Hello World</h1>”, “IonCannon.js” => <p>Feel my power!</p>, }.
-
#render_blank ⇒ Object
Example of what is returned by this method: { “DeathStarLaserComponent.js” => <div>I am blank</div>, “IonCannon.js” => <div>I am blank</div>, }.
Constructor Details
#initialize(jobs) ⇒ BatchRenderer
Returns a new instance of BatchRenderer.
4 5 6 |
# File 'lib/hypernova/batch_renderer.rb', line 4 def initialize(jobs) @jobs = jobs end |
Instance Method Details
#render(response) ⇒ Object
Example of what is returned by this method:
"DeathStarLaserComponent.js" => "<h1>Hello World</h1>",
"IonCannon.js" => <p>Feel my power!</p>,
36 37 38 39 40 41 |
# File 'lib/hypernova/batch_renderer.rb', line 36 def render(response) response.each_with_object({}) do |array, hash| name_of_component = array[0] hash[name_of_component] = extract_html_from_result(name_of_component, array[1]) end end |
#render_blank ⇒ Object
Example of what is returned by this method:
"DeathStarLaserComponent.js" => <div>I am blank</div>,
"IonCannon.js" => <div>I am blank</div>,
48 49 50 51 52 |
# File 'lib/hypernova/batch_renderer.rb', line 48 def render_blank hash = {} jobs.each { |name_of_component, job| hash[name_of_component] = render_blank_html(job) } hash end |