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.
11 12 13 14 15 16 17 |
# File 'lib/link_thumbnailer/models/description.rb', line 11 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.
8 9 10 |
# File 'lib/link_thumbnailer/models/description.rb', line 8 def candidates_number @candidates_number end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
8 9 10 |
# File 'lib/link_thumbnailer/models/description.rb', line 8 def node @node end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
8 9 10 |
# File 'lib/link_thumbnailer/models/description.rb', line 8 def position @position end |
#probability ⇒ Object
Returns the value of attribute probability.
9 10 11 |
# File 'lib/link_thumbnailer/models/description.rb', line 9 def probability @probability end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
8 9 10 |
# File 'lib/link_thumbnailer/models/description.rb', line 8 def text @text end |
Instance Method Details
#<=>(other) ⇒ Object
23 24 25 |
# File 'lib/link_thumbnailer/models/description.rb', line 23 def <=>(other) probability <=> other.probability end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/link_thumbnailer/models/description.rb', line 19 def to_s text end |