class MarkdownToRspec::ToRspec::Item::Paragraph
Attributes
children[R]
depth[R]
parent[R]
text[R]
Public Class Methods
new(text:, parent: nil, children: [])
click to toggle source
# File lib/markdown_to_rspec/to_rspec/item/paragraph.rb, line 7 def initialize(text:, parent: nil, children: []) @text = text @parent = parent @children = children @depth = parent ? parent.depth + 1 : 0 end
Public Instance Methods
convert()
click to toggle source
# File lib/markdown_to_rspec/to_rspec/item/paragraph.rb, line 16 def convert lines = text.split("\n").map { |line| template(line) } lines.map { |line| indent(line) }.join("\n") end
Private Instance Methods
template(text)
click to toggle source
# File lib/markdown_to_rspec/to_rspec/item/paragraph.rb, line 23 def template(text) "# #{text}" end