Sha256: 00f0f0b3a481fc062c0614cbf318e9231c6366ddb36285233a4beb5ac7e8889a

Contents?: true

Size: 919 Bytes

Versions: 3

Compression:

Stored size: 919 Bytes

Contents

module BioInterchange::TextMining

class Document

  # Creates a blank document representation.
  #
  # +uri+:: source of the document
  def initialize(uri)
    @uri = uri

    # Will hold content:
    @content = []
  end

  # Returns the URI of the document.
  def uri
    @uri
  end

  # Adds content to the document.
  #
  # +content+:: content of type +BioInterchange::TextMining::Content+ that should be added to the document
  def add(content)
    if ( (! content.kind_of?(BioInterchange::TextMining::Content)) && (! content.kind_of?(BioInterchange::TextMining::ContentConnection)) )
      raise BioInterchange::Exceptions::ImplementationModelError, 'Content has to be of kind BioInterchange::TextMining::Content or kind BioInterchange::TextMining::ContentConnection' 
    end
    @content << content
  end

  # Returns the document contents as an array.
  def contents
    @content.clone.freeze
  end

end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
biointerchange-0.2.1 lib/biointerchange/textmining/document.rb
biointerchange-0.2.0 lib/biointerchange/textmining/document.rb
biointerchange-0.1.3 lib/biointerchange/textmining/document.rb