class BioInterchange::TextMining::Document

Public Class Methods

new(uri) click to toggle source

Creates a blank document representation.

uri

source of the document

# File lib/biointerchange/textmining/document.rb, line 8
def initialize(uri)
  @uri = uri

  # Will hold content:
  @content = []
end

Public Instance Methods

add(content) click to toggle source

Adds content to the document.

content

content of type BioInterchange::TextMining::Content that should be added to the document

# File lib/biointerchange/textmining/document.rb, line 23
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
contents() click to toggle source

Returns the document contents as an array.

# File lib/biointerchange/textmining/document.rb, line 31
def contents
  @content.clone.freeze
end
uri() click to toggle source

Returns the URI of the document.

# File lib/biointerchange/textmining/document.rb, line 16
def uri
  @uri
end