Class: NotionOrbit::NotionObjects::Blocks
- Inherits:
-
Object
- Object
- NotionOrbit::NotionObjects::Blocks
- Includes:
- Enumerable
- Defined in:
- lib/notion_orbit/notion_objects/blocks.rb
Instance Attribute Summary collapse
-
#blocks ⇒ Object
Returns the value of attribute blocks.
Instance Method Summary collapse
-
#initialize(raw_blocks, notion_api_key, indentation: 0) ⇒ Blocks
constructor
A new instance of Blocks.
- #to_markdown ⇒ Object
Constructor Details
#initialize(raw_blocks, notion_api_key, indentation: 0) ⇒ Blocks
Returns a new instance of Blocks.
8 9 10 11 12 |
# File 'lib/notion_orbit/notion_objects/blocks.rb', line 8 def initialize(raw_blocks, notion_api_key, indentation: 0) @blocks = raw_blocks.map{ |raw_block| Block.new_from_raw_block(raw_block, notion_api_key, indentation: indentation) } @notion_api_key = notion_api_key @indentation = indentation end |
Instance Attribute Details
#blocks ⇒ Object
Returns the value of attribute blocks.
6 7 8 |
# File 'lib/notion_orbit/notion_objects/blocks.rb', line 6 def blocks @blocks end |
Instance Method Details
#to_markdown ⇒ Object
14 15 16 |
# File 'lib/notion_orbit/notion_objects/blocks.rb', line 14 def to_markdown @blocks.map { |block| " " * @indentation + block.to_markdown }.join("\n").rstrip.gsub("\n","\\n") end |