Sha256: a42ccb6b177532b8dccd7f3ae4ce086a86e107e593692143f184171b69d97dd2
Contents?: true
Size: 931 Bytes
Versions: 1
Compression:
Stored size: 931 Bytes
Contents
module Boilerpipe module Document class TextDocument attr_reader :text_blocks attr_accessor :title def initialize(title, text_blocks) @text_blocks = text_blocks @title = title end def content text(true, false) end def text(include_content, include_noncontent) s = '' @text_blocks.each do |text_block| case text_block.is_content? when true next unless include_content s << text_block.text s << '\n' when false next unless include_noncontent s << text_block.text s << '\n' end end s end def replace_text_blocks!(new_blocks) @text_blocks = new_blocks end def debug_s @text_blocks.map(&:to_s).join("\n") end alias_method :debug_string, :debug_s end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
boilerpipe-ruby-0.1.0 | lib/boilerpipe/document/text_document.rb |