Class: HalClient::TemplatedLink

Inherits:
Link
  • Object
show all
Defined in:
lib/hal_client/link.rb

Overview

Links that are templated.

Instance Attribute Summary

Attributes inherited from Link

#curie_resolver, #literal_rel

Instance Method Summary collapse

Methods inherited from Link

#==, #fully_qualified_rel

Instance Method Details

#hashObject

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



125
126
127
128
129
# File 'lib/hal_client/link.rb', line 125

def hash
  [fully_qualified_rel,
   tmpl.pattern,
   templated?].hash
end

#raw_hrefObject



106
107
108
# File 'lib/hal_client/link.rb', line 106

def raw_href
  tmpl
end

#target(vars = {}) ⇒ Object



118
119
120
# File 'lib/hal_client/link.rb', line 118

def target(vars = {})
  Representation.new(href: target_url(vars), hal_client: hal_client)
end

#target_url(vars = {}) ⇒ Object



114
115
116
# File 'lib/hal_client/link.rb', line 114

def target_url(vars = {})
  tmpl.expand(vars)
end

#templated?Boolean

Returns:

  • (Boolean)


110
111
112
# File 'lib/hal_client/link.rb', line 110

def templated?
  true
end