Class Estraier::Document
In: estraier.rb
Parent: Object

Abstraction of document.

Methods

Public Class methods

Create a document object. `draft’ specifies a string of draft data.

Public Instance methods

Add an attribute. `name’ specifies the name of an attribute. `value’ specifies the value of the attribute. If it is nil, the attribute is removed.

Add a hidden sentence. `text’ specifies a hidden sentence.

Add a sentence of text. `text’ specifies a sentence of text.

Get the value of an attribute. `name’ specifies the name of an attribute. The return value is the value of the attribute or nil if it does not exist.

Get a list of attribute names of a document object. The return value is a list object of attribute names.

Concatenate sentences of the text of a document object. The return value is concatenated sentences.

Dump draft data of a document object. The return value is draft data.

Get the ID number. The return value is the ID number of the document object. If the object has never been registered, -1 is returned.

Make a snippet of the body text of a document object. `word’ specifies a list object of words to be highlight. `wwitdh’ specifies whole width of the result. `hwitdh’ specifies width of strings picked up from the beginning of the text. `awitdh’ specifies width of strings picked up around each highlighted word. The return value is a snippet string of the body text. There are tab separated values. Each line is a string to be shown. Though most lines have only one field, some lines have two fields. If the second field exists, the first field is to be shown with highlighted, and the second field means its normalized form.

Check whether the text of a document object includes every specified words. `word’ specifies a list object of words to be checked. The return value is true if every specified words is found, else it is false.

Get a list of sentences of the text. The return value is a list object of sentences of the text.

[Validate]