Class: Workarea::ExtractContentBlockText
- Inherits:
-
Object
- Object
- Workarea::ExtractContentBlockText
- Defined in:
- app/queries/workarea/extract_content_block_text.rb
Instance Method Summary collapse
-
#initialize(blocks) ⇒ ExtractContentBlockText
constructor
A new instance of ExtractContentBlockText.
- #text ⇒ Object
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
#text ⇒ Object
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 |