Class: Lookbook::RenderedScenarioEntity
- Inherits:
-
Object
- Object
- Lookbook::RenderedScenarioEntity
- Defined in:
- lib/lookbook/entities/rendered_scenario_entity.rb
Overview
Represents a rendered preview scenario.
Extends ScenarioEntity with an ‘output` method that returns the rendered HTML output.
See the [ScenarioEntity](./scenario_entity) docs for other available methods.
Instance Attribute Summary collapse
-
#output ⇒ String
readonly
HTML output of the rendered scenario.
- #scenario ⇒ Object readonly private
Instance Method Summary collapse
-
#beautified_output ⇒ String
‘Beautified’ HTML output of the rendered scenario.
-
#initialize(scenario, output, params) ⇒ RenderedScenarioEntity
constructor
private
A new instance of RenderedScenarioEntity.
- #source ⇒ Object private
- #source_lang ⇒ Object private
Constructor Details
#initialize(scenario, output, params) ⇒ RenderedScenarioEntity
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of RenderedScenarioEntity.
17 18 19 20 21 |
# File 'lib/lookbook/entities/rendered_scenario_entity.rb', line 17 def initialize(scenario, output, params) @scenario = scenario @params = params @output = output end |
Instance Attribute Details
#output ⇒ String (readonly)
HTML output of the rendered scenario.
26 27 28 |
# File 'lib/lookbook/entities/rendered_scenario_entity.rb', line 26 def output @output end |
#scenario ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 |
# File 'lib/lookbook/entities/rendered_scenario_entity.rb', line 14 def scenario @scenario end |
Instance Method Details
#beautified_output ⇒ String
‘Beautified’ HTML output of the rendered scenario.
31 32 33 |
# File 'lib/lookbook/entities/rendered_scenario_entity.rb', line 31 def beautified_output @_beautified_output ||= CodeBeautifier.call(output) end |
#source ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
36 37 38 |
# File 'lib/lookbook/entities/rendered_scenario_entity.rb', line 36 def source has_custom_template? ? template_source(template) : scenario.source end |
#source_lang ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
41 42 43 |
# File 'lib/lookbook/entities/rendered_scenario_entity.rb', line 41 def source_lang has_custom_template? ? template_lang(template) : scenario.source_lang end |