Class: Retreval::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/retreval/gold_standard.rb

Overview

A Document is a generic resource that is identified by its ID (which could be anything).

Direct Known Subclasses

ResultDocument

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Document) initialize(args)

Creates a new Document object with a specified id



360
361
362
363
# File 'lib/retreval/gold_standard.rb', line 360

def initialize(args)
  @id = args[:id].to_s
  raise "Can not construct a Document with an empty identifier" if @id.nil?
end

Instance Attribute Details

- (Object) id (readonly)

Returns the value of attribute id



352
353
354
# File 'lib/retreval/gold_standard.rb', line 352

def id
  @id
end

Instance Method Details

- (Object) ==(document)

Compares two Document objects according to their id



355
356
357
# File 'lib/retreval/gold_standard.rb', line 355

def ==(document)
  document.id == self.id
end