Sha256: 08cf84dac98fb7d43115be91484d3bdf29865957222cee4f9f1d1688f6474cc4

Contents?: true

Size: 943 Bytes

Versions: 9

Compression:

Stored size: 943 Bytes

Contents

module BioInterchange::TextMining

class Document < BioInterchange::Model

  # 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

9 entries across 9 versions & 1 rubygems

Version Path
biointerchange-1.0.8 lib/biointerchange/textmining/document.rb
biointerchange-1.0.7 lib/biointerchange/textmining/document.rb
biointerchange-1.0.6 lib/biointerchange/textmining/document.rb
biointerchange-1.0.5 lib/biointerchange/textmining/document.rb
biointerchange-1.0.4 lib/biointerchange/textmining/document.rb
biointerchange-1.0.2 lib/biointerchange/textmining/document.rb
biointerchange-1.0.1 lib/biointerchange/textmining/document.rb
biointerchange-1.0.0 lib/biointerchange/textmining/document.rb
biointerchange-0.2.2 lib/biointerchange/textmining/document.rb