Class: LinkThumbnailer::Models::Description
- Inherits:
-
LinkThumbnailer::Model
- Object
- LinkThumbnailer::Model
- LinkThumbnailer::Models::Description
- Defined in:
- lib/link_thumbnailer/models/description.rb
Instance Attribute Summary collapse
-
#candidates_number ⇒ Object
readonly
Returns the value of attribute candidates_number.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#probability ⇒ Object
Returns the value of attribute probability.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(node, text, position = 1, candidates_number = 1) ⇒ Description
constructor
A new instance of Description.
- #to_s ⇒ Object
Methods inherited from LinkThumbnailer::Model
Constructor Details
#initialize(node, text, position = 1, candidates_number = 1) ⇒ Description
Returns a new instance of Description.
13 14 15 16 17 18 19 |
# File 'lib/link_thumbnailer/models/description.rb', line 13 def initialize(node, text, position = 1, candidates_number = 1) @node = node @text = sanitize(text) @position = position @candidates_number = candidates_number @probability = compute_probability end |
Instance Attribute Details
#candidates_number ⇒ Object (readonly)
Returns the value of attribute candidates_number.
10 11 12 |
# File 'lib/link_thumbnailer/models/description.rb', line 10 def candidates_number @candidates_number end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
10 11 12 |
# File 'lib/link_thumbnailer/models/description.rb', line 10 def node @node end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
10 11 12 |
# File 'lib/link_thumbnailer/models/description.rb', line 10 def position @position end |
#probability ⇒ Object
Returns the value of attribute probability.
11 12 13 |
# File 'lib/link_thumbnailer/models/description.rb', line 11 def probability @probability end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
10 11 12 |
# File 'lib/link_thumbnailer/models/description.rb', line 10 def text @text end |
Instance Method Details
#<=>(other) ⇒ Object
25 26 27 |
# File 'lib/link_thumbnailer/models/description.rb', line 25 def <=>(other) probability <=> other.probability end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/link_thumbnailer/models/description.rb', line 21 def to_s text end |