Class: Lookbook::RenderedScenarioEntity

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#outputString (readonly)

HTML output of the rendered scenario.

Returns:

  • (String)

    Rendered output



26
27
28
# File 'lib/lookbook/entities/rendered_scenario_entity.rb', line 26

def output
  @output
end

#scenarioObject (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_outputString

‘Beautified’ HTML output of the rendered scenario.

Returns:

  • (String)

    Rendered output



31
32
33
# File 'lib/lookbook/entities/rendered_scenario_entity.rb', line 31

def beautified_output
  @_beautified_output ||= CodeBeautifier.call(output)
end

#sourceObject

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_langObject

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