Sha256: 521cb736f6b98372e82641bc150eaccd2b5ade109f633714e312e5aaaef43a2a

Contents?: true

Size: 565 Bytes

Versions: 5

Compression:

Stored size: 565 Bytes

Contents

module NotionOrbit
  module NotionObjects
    class Blocks
      include Enumerable

      attr_accessor :blocks

      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

      def to_markdown
        @blocks.map { |block| " " * @indentation + block.to_markdown }.join("\n").rstrip.gsub("\n","\\n")
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
notion_orbit-0.0.7 lib/notion_orbit/notion_objects/blocks.rb
notion_orbit-0.0.6 lib/notion_orbit/notion_objects/blocks.rb
notion_orbit-0.0.5 lib/notion_orbit/notion_objects/blocks.rb
notion_orbit-0.0.4 lib/notion_orbit/notion_objects/blocks.rb
notion_orbit-0.0.3 lib/notion_orbit/notion_objects/blocks.rb