Class: LieDetector::MarkdownRunner
- Inherits:
-
Redcarpet::Render::Base
- Object
- Redcarpet::Render::Base
- LieDetector::MarkdownRunner
- Defined in:
- lib/liedetector/markdown_runner.rb
Constant Summary collapse
- LEVEL_DOTS =
{1 => '=', 2 => '-', 3 => '.'}
Instance Method Summary collapse
- #block_code(code, language) ⇒ Object
- #header(text, header_level) ⇒ Object
- #image(link, title, content) ⇒ Object
-
#initialize(suite) ⇒ MarkdownRunner
constructor
A new instance of MarkdownRunner.
-
#link(link, title, content) ⇒ Object
Other methods where we don’t return only a specific argument.
- #normal_text(text) ⇒ Object
- #paragraph(text) ⇒ Object
Constructor Details
#initialize(suite) ⇒ MarkdownRunner
Returns a new instance of MarkdownRunner.
3 4 5 6 |
# File 'lib/liedetector/markdown_runner.rb', line 3 def initialize(suite) @suite = suite super() end |
Instance Method Details
#block_code(code, language) ⇒ Object
8 9 10 11 |
# File 'lib/liedetector/markdown_runner.rb', line 8 def block_code(code, language) @suite.code_block(code) nil end |
#header(text, header_level) ⇒ Object
58 59 60 61 |
# File 'lib/liedetector/markdown_runner.rb', line 58 def header(text, header_level) @suite.push_descriptions("\n#{text}\n#{LEVEL_DOTS[header_level] * text.size}\n") nil end |
#image(link, title, content) ⇒ Object
46 47 48 49 50 |
# File 'lib/liedetector/markdown_runner.rb', line 46 def image(link, title, content) content &&= content + " " @suite.push_descriptions "#{content}#{link}" nil end |
#link(link, title, content) ⇒ Object
Other methods where we don’t return only a specific argument
41 42 43 44 |
# File 'lib/liedetector/markdown_runner.rb', line 41 def link(link, title, content) @suite.push_descriptions "#{content} (#{link})" nil end |
#normal_text(text) ⇒ Object
35 36 37 |
# File 'lib/liedetector/markdown_runner.rb', line 35 def normal_text(text) text end |
#paragraph(text) ⇒ Object
52 53 54 55 |
# File 'lib/liedetector/markdown_runner.rb', line 52 def paragraph(text) @suite.push_descriptions("\n#{text}\n") nil end |