Class: MarkdownToRspec::ToRspec::Item::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/markdown_to_rspec/to_rspec/item/base.rb

Direct Known Subclasses

Heading, List, ListItem, Paragraph

Instance Method Summary collapse

Instance Method Details

#childrenObject

Raises:

  • (NotImplementedError)


11
12
13
# File 'lib/markdown_to_rspec/to_rspec/item/base.rb', line 11

def children
  raise NotImplementedError
end

#convertObject

Raises:

  • (NotImplementedError)


19
20
21
# File 'lib/markdown_to_rspec/to_rspec/item/base.rb', line 19

def convert
  raise NotImplementedError
end

#depthObject

Raises:

  • (NotImplementedError)


7
8
9
# File 'lib/markdown_to_rspec/to_rspec/item/base.rb', line 7

def depth
  raise NotImplementedError
end

#indent(line, indent_length = 2, indent_string = ' ') ⇒ String

insert indentation with depth in mind. For example, if depth is 2, indext(“foo bar”) #=> “ foo bar”

ex) depth: 2

Parameters:

  • line (String)

    The string of the line to insert the indent.

  • indent_length (Intger) (defaults to: 2)

    The number of indented characters.

  • indent_string (String) (defaults to: ' ')

    Character to be used for indentation.

Returns:

  • (String)

    Indented string.



34
35
36
# File 'lib/markdown_to_rspec/to_rspec/item/base.rb', line 34

def indent(line, indent_length = 2, indent_string = ' ')
  line.dup.prepend(indent_string * indent_length * depth)
end

#parentObject

Raises:

  • (NotImplementedError)


15
16
17
# File 'lib/markdown_to_rspec/to_rspec/item/base.rb', line 15

def parent
  raise NotImplementedError
end