Class: MarkdownToRspec::ToRspec::Item::List
- Defined in:
- lib/markdown_to_rspec/to_rspec/item/list.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#depth ⇒ Object
readonly
Returns the value of attribute depth.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
- #convert ⇒ Object
-
#initialize(parent: nil, children: []) ⇒ List
constructor
A new instance of List.
Methods inherited from Base
Constructor Details
#initialize(parent: nil, children: []) ⇒ List
Returns a new instance of List.
7 8 9 10 11 |
# File 'lib/markdown_to_rspec/to_rspec/item/list.rb', line 7 def initialize(parent: nil, children: []) @parent = parent @children = children @depth = parent ? parent.depth + 1 : 0 end |
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
14 15 16 |
# File 'lib/markdown_to_rspec/to_rspec/item/list.rb', line 14 def children @children end |
#depth ⇒ Object (readonly)
Returns the value of attribute depth.
13 14 15 |
# File 'lib/markdown_to_rspec/to_rspec/item/list.rb', line 13 def depth @depth end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
13 14 15 |
# File 'lib/markdown_to_rspec/to_rspec/item/list.rb', line 13 def parent @parent end |
Instance Method Details
#convert ⇒ Object
16 17 18 |
# File 'lib/markdown_to_rspec/to_rspec/item/list.rb', line 16 def convert children.map(&:convert).join("\n") end |