Sha256: 7c5be0a607d66b45c298d4bcbe4ff64ce015b93683a4292120d3d5aae87bb925
Contents?: true
Size: 934 Bytes
Versions: 2
Compression:
Stored size: 934 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
boilerpipe-ruby-0.4.2 | lib/boilerpipe/document/text_document.rb |
boilerpipe-ruby-0.4.1 | lib/boilerpipe/document/text_document.rb |