Class: NotionToMd::Blocks::Factory

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

Class Method Summary collapse

Class Method Details

.build(block:, children: []) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/notion_to_md/blocks/factory.rb', line 6

def self.build(block:, children: [])
  case block.type.to_sym
  when :table
    TableBlock.new(block: block, children: children)
  when :table_row
    TableRowBlock.new(block: block, children: children)
  when :bulleted_list_item
    BulletedListItemBlock.new(block: block, children: children)
  when :numbered_list_item
    NumberedListItemBlock.new(block: block, children: children)
  when :to_do
    ToDoListItemBlock.new(block: block, children: children)
  else
    Blocks::Block.new(block: block, children: children)
  end
end