Class: Workarea::ExtractContentBlockText

Inherits:
Object
  • Object
show all
Defined in:
app/queries/workarea/extract_content_block_text.rb

Instance Method Summary collapse

Constructor Details

#initialize(blocks) ⇒ ExtractContentBlockText

Returns a new instance of ExtractContentBlockText.



3
4
5
# File 'app/queries/workarea/extract_content_block_text.rb', line 3

def initialize(blocks)
  @blocks = Array(blocks)
end

Instance Method Details

#textObject



7
8
9
10
11
12
# File 'app/queries/workarea/extract_content_block_text.rb', line 7

def text
  @blocks.reduce('') do |memo, block|
    memo << ' ' unless memo.blank?
    memo << extract_text(block.data)
  end
end