Class: Halibut::Core::Link
- Inherits:
-
Object
- Object
- Halibut::Core::Link
- Extended by:
- Forwardable
- Defined in:
- lib/halibut/core/link.rb
Overview
This class represents a HAL Link object.
spec spec spec.
Defined Under Namespace
Classes: Options
Instance Attribute Summary collapse
-
#href ⇒ Object
readonly
The URI associated with this link.
Instance Method Summary collapse
-
#==(other) ⇒ true, false
Generic comparison method.
-
#initialize(href, opts = {}) ⇒ Halibut::Core::Link
constructor
Returns an instance of a HAL Link object.
-
#to_hash ⇒ Hash
Simply returns a hash of the href and the options that are not empty.
Constructor Details
#initialize(href, opts = {}) ⇒ Halibut::Core::Link
Returns an instance of a HAL Link object
# link with no options
link = Link.new('http://homeopathy.org')
# link with name and type options
link = Link.new('http://homeopathy.org', name: 'Homeopath'
, type: 'text/html')
If you pass an options that is not one of the reserved link properties as defined by the spec, they are dropped. It should possibly raise an error, hafta think about it.
31 32 33 34 |
# File 'lib/halibut/core/link.rb', line 31 def initialize(href, opts={}) @href = href @options = Options.new opts end |
Instance Attribute Details
#href ⇒ Object (readonly)
The URI associated with this link.
9 10 11 |
# File 'lib/halibut/core/link.rb', line 9 def href @href end |
Instance Method Details
#==(other) ⇒ true, false
58 59 60 |
# File 'lib/halibut/core/link.rb', line 58 def ==(other) @href == other.href && @options == other. end |