Class: Halva::Link
- Inherits:
-
Object
- Object
- Halva::Link
- Defined in:
- lib/halva/link.rb
Overview
HAL Link Object See [HAL Draft](datatracker.ietf.org/doc/html/draft-kelly-json-hal#section-5)
Instance Attribute Summary collapse
-
#relation ⇒ Object
readonly
Returns the value of attribute relation.
Instance Method Summary collapse
-
#initialize(href, relation, options = {}) ⇒ Link
constructor
A new instance of Link.
- #to_h ⇒ Object
Constructor Details
#initialize(href, relation, options = {}) ⇒ Link
Returns a new instance of Link.
19 20 21 22 23 |
# File 'lib/halva/link.rb', line 19 def initialize(href, relation, = {}) @href = href @relation = relation.to_sym @options = end |
Instance Attribute Details
#relation ⇒ Object (readonly)
Returns the value of attribute relation.
7 8 9 |
# File 'lib/halva/link.rb', line 7 def relation @relation end |
Instance Method Details
#to_h ⇒ Object
25 26 27 |
# File 'lib/halva/link.rb', line 25 def to_h { href: @href, **@options } end |