class HalClient::Link
HAL representation of a single link. Provides access to an embedded representation.
Attributes
curie_resolver[R]
literal_rel[R]
Public Class Methods
new(rel:, curie_resolver: CurieResolver.new([]), **opts)
click to toggle source
# File lib/hal_client/link.rb, line 7 def initialize(rel:, curie_resolver: CurieResolver.new([]), **opts) @literal_rel = rel @curie_resolver = curie_resolver post_initialize(opts) end
Public Instance Methods
==(other)
click to toggle source
Links with the same href, same rel value, and the same 'templated' value are considered equal. Otherwise, they are considered unequal. Links without a href (for example anonymous embedded links, are never equal to one another.
# File lib/hal_client/link.rb, line 40 def ==(other) return false if raw_href.nil? return false unless other.respond_to?(:raw_href) && other.respond_to?(:fully_qualified_rel) && other.respond_to?(:templated?) (raw_href == other.raw_href) && (fully_qualified_rel == other.fully_qualified_rel) && (templated? == other.templated?) end
Also aliased as: eql?
fully_qualified_rel()
click to toggle source
# File lib/hal_client/link.rb, line 32 def fully_qualified_rel curie_resolver.resolve(literal_rel) end
hash()
click to toggle source
Differing Representations or Addressable::Templates with matching hrefs will get matching hash values, since we are using raw_href
and not the objects themselves when computing hash
# File lib/hal_client/link.rb, line 57 def hash [fully_qualified_rel, raw_href, templated?].hash end
raw_href()
click to toggle source
# File lib/hal_client/link.rb, line 14 def raw_href raise NotImplementedError end
target(vars = {})
click to toggle source
# File lib/hal_client/link.rb, line 22 def target(vars = {}) raise NotImplementedError end
target_url(vars = {})
click to toggle source
# File lib/hal_client/link.rb, line 18 def target_url(vars = {}) raise NotImplementedError end
templated?()
click to toggle source
# File lib/hal_client/link.rb, line 26 def templated? raise NotImplementedError end
Protected Instance Methods
post_initialize(opts)
click to toggle source
# File lib/hal_client/link.rb, line 65 def post_initialize(opts) end