Class: Chemicalml::Dictionary::Link
- Inherits:
-
Object
- Object
- Chemicalml::Dictionary::Link
- Defined in:
- lib/chemicalml/dictionary/link.rb
Overview
One external link from an entry's description or definition.
Maps to the xhtml:a element in the original CML dictionary
entries.
Instance Attribute Summary collapse
-
#href ⇒ Object
readonly
Returns the value of attribute href.
-
#rel ⇒ Object
readonly
Returns the value of attribute rel.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
-
#initialize(rel:, href:, title: nil) ⇒ Link
constructor
A new instance of Link.
- #to_h ⇒ Object
Constructor Details
#initialize(rel:, href:, title: nil) ⇒ Link
Returns a new instance of Link.
11 12 13 14 15 16 |
# File 'lib/chemicalml/dictionary/link.rb', line 11 def initialize(rel:, href:, title: nil) @rel = rel @href = href @title = title freeze end |
Instance Attribute Details
#href ⇒ Object (readonly)
Returns the value of attribute href.
9 10 11 |
# File 'lib/chemicalml/dictionary/link.rb', line 9 def href @href end |
#rel ⇒ Object (readonly)
Returns the value of attribute rel.
9 10 11 |
# File 'lib/chemicalml/dictionary/link.rb', line 9 def rel @rel end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
9 10 11 |
# File 'lib/chemicalml/dictionary/link.rb', line 9 def title @title end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
22 23 24 |
# File 'lib/chemicalml/dictionary/link.rb', line 22 def eql?(other) other.is_a?(Link) && to_h == other.to_h end |
#hash ⇒ Object
27 28 29 |
# File 'lib/chemicalml/dictionary/link.rb', line 27 def hash to_h.hash end |
#to_h ⇒ Object
18 19 20 |
# File 'lib/chemicalml/dictionary/link.rb', line 18 def to_h { rel: rel, href: href, title: title }.compact end |