Class: NotionToMd::Blocks::BulletedListBlock

Inherits:
Block
  • Object
show all
Defined in:
lib/notion_to_md/blocks/bulleted_list_block.rb

Direct Known Subclasses

NumberedListBlock, ToDoListBlock

Instance Attribute Summary

Attributes inherited from Block

#block, #children

Instance Method Summary collapse

Constructor Details

#initialize(children: []) ⇒ BulletedListBlock

Returns a new instance of BulletedListBlock.



6
7
8
# File 'lib/notion_to_md/blocks/bulleted_list_block.rb', line 6

def initialize(children: [])
  @children = children
end

Instance Method Details

#newlineObject



29
30
31
# File 'lib/notion_to_md/blocks/bulleted_list_block.rb', line 29

def newline
  "\n"
end

#to_md(tab_width: 0) ⇒ Object

Parameters:

tab_width

The number of tabs used to indent the block.

Returns

The current block (and its children) converted to a markdown string.



17
18
19
20
21
22
23
# File 'lib/notion_to_md/blocks/bulleted_list_block.rb', line 17

def to_md(tab_width: 0)
  if tab_width.zero?
    build_nested_blocks(tab_width) + newline
  else
    build_nested_blocks(tab_width)
  end
end

#typeObject



25
26
27
# File 'lib/notion_to_md/blocks/bulleted_list_block.rb', line 25

def type
  'bulleted_list'
end