class Stride::AtlassianDocumentFormatExpander::ContentBlocks

Attributes

initial_json[RW]

Public Class Methods

new(initial_json) click to toggle source
# File lib/stride/atlassian_document_format_expander.rb, line 19
def initialize(initial_json)
  self.initial_json = initial_json
end

Public Instance Methods

as_json() click to toggle source
# File lib/stride/atlassian_document_format_expander.rb, line 23
def as_json
  wrapped_blocks.map(&:as_json).flatten
end

Private Instance Methods

wrapped_blocks() click to toggle source
# File lib/stride/atlassian_document_format_expander.rb, line 31
def wrapped_blocks
  initial_json.map do |content_block_json|
    if content_block_json.has_key?('content')
      content_block_json['content'] = ContentBlocks.new(content_block_json['content']).as_json
      content_block_json
    else
      ContentBlock.new(content_block_json)
    end
  end
end