Class: Documentrix::Documents::Cache::Records::Record
- Inherits:
-
JSON::GenericObject
- Object
- JSON::GenericObject
- Documentrix::Documents::Cache::Records::Record
- Defined in:
- lib/documentrix/documents/cache/records.rb
Instance Method Summary collapse
-
#==(other) ⇒ FalseClass, TrueClass
The == method compares this record with another one by comparing their text fields.
-
#initialize(options = {}) ⇒ Record
constructor
The initialize method sets default values for the text and norm attributes.
-
#tags_set ⇒ Documentrix::Utils::Tags
The tags_set method creates a new Documentrix::Utils::Tags object from the tags and source of this instance.
-
#to_s ⇒ String
(also: #inspect)
The to_s method returns a string representation of the object.
Constructor Details
#initialize(options = {}) ⇒ Record
The initialize method sets default values for the text and norm attributes.
7 8 9 10 11 |
# File 'lib/documentrix/documents/cache/records.rb', line 7 def initialize( = {}) super self.text ||= '' self.norm ||= 0.0 end |
Instance Method Details
#==(other) ⇒ FalseClass, TrueClass
The == method compares this record with another one by comparing their text fields.
38 39 40 |
# File 'lib/documentrix/documents/cache/records.rb', line 38 def ==(other) text == other.text end |
#tags_set ⇒ Documentrix::Utils::Tags
The tags_set method creates a new Documentrix::Utils::Tags object from the tags and source of this instance.
27 28 29 |
# File 'lib/documentrix/documents/cache/records.rb', line 27 def Documentrix::Utils::Tags.new(, source:) end |
#to_s ⇒ String Also known as: inspect
The to_s method returns a string representation of the object.
along with its similarity score.
17 18 19 20 21 |
# File 'lib/documentrix/documents/cache/records.rb', line 17 def to_s = .empty? or = " #{}" "#<#{self.class} #{text.inspect}#{} #{similarity || 'n/a'}>" end |