Module: TurnipFormatter::Renderer::Html

Defined in:
lib/turnip_formatter/renderer/html.rb,
lib/turnip_formatter/renderer/html/base.rb,
lib/turnip_formatter/renderer/html/step.rb,
lib/turnip_formatter/renderer/html/index.rb,
lib/turnip_formatter/renderer/html/scenario.rb,
lib/turnip_formatter/renderer/html/data_table.rb,
lib/turnip_formatter/renderer/html/doc_string.rb,
lib/turnip_formatter/renderer/html/runtime_error.rb,
lib/turnip_formatter/renderer/html/statistics_tag.rb,
lib/turnip_formatter/renderer/html/statistics_speed.rb,
lib/turnip_formatter/renderer/html/statistics_feature.rb

Defined Under Namespace

Classes: Base, DataTable, DocString, Index, RuntimeError, Scenario, StatisticsFeature, StatisticsSpeed, StatisticsTag, Step

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.script_codesObject

Returns the value of attribute script_codes.



10
11
12
# File 'lib/turnip_formatter/renderer/html.rb', line 10

def script_codes
  @script_codes
end

.script_filesObject

Returns the value of attribute script_files.



10
11
12
# File 'lib/turnip_formatter/renderer/html.rb', line 10

def script_files
  @script_files
end

.style_codesObject

Returns the value of attribute style_codes.



10
11
12
# File 'lib/turnip_formatter/renderer/html.rb', line 10

def style_codes
  @style_codes
end

.style_filesObject

Returns the value of attribute style_files.



10
11
12
# File 'lib/turnip_formatter/renderer/html.rb', line 10

def style_files
  @style_files
end

Class Method Details

.add_javascript(script) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/turnip_formatter/renderer/html.rb', line 23

def add_javascript(script)
  case
  when local_file?(script)
    script_codes << File.read(script)
  when remote_url?(script)
    script_files << script
  end
end

.add_stylesheet(stylesheet) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/turnip_formatter/renderer/html.rb', line 32

def add_stylesheet(stylesheet)
  case
  when local_file?(stylesheet)
    style_codes << File.read(stylesheet)
  when remote_url?(stylesheet)
    style_files << stylesheet
  end
end

.project_nameObject



19
20
21
# File 'lib/turnip_formatter/renderer/html.rb', line 19

def project_name
  TurnipFormatter.configuration.title
end

.render_javascript_codesObject



41
42
43
# File 'lib/turnip_formatter/renderer/html.rb', line 41

def render_javascript_codes
  script_codes.join("\n")
end


45
46
47
48
49
# File 'lib/turnip_formatter/renderer/html.rb', line 45

def render_javascript_links
  script_files.map do |file|
    "<script src=\"#{file}\"></script>"
  end.join("\n")
end

.render_step_template_stylesheet_codesObject



61
62
63
64
65
# File 'lib/turnip_formatter/renderer/html.rb', line 61

def render_step_template_stylesheet_codes
  TurnipFormatter.step_templates.map do |template|
    template.class.css
  end.join("\n")
end

.render_stylesheet_codesObject



51
52
53
# File 'lib/turnip_formatter/renderer/html.rb', line 51

def render_stylesheet_codes
  style_codes.join("\n")
end


55
56
57
58
59
# File 'lib/turnip_formatter/renderer/html.rb', line 55

def render_stylesheet_links
  style_files.map do |file|
    "<link rel=\"stylesheet\" href=\"#{file}\">"
  end.join("\n")
end

.reset!Object



12
13
14
15
16
17
# File 'lib/turnip_formatter/renderer/html.rb', line 12

def reset!
  @script_codes = []
  @script_files = []
  @style_codes = []
  @style_files = []
end