class HalClient::TemplatedLink
Links that are templated.
Attributes
hal_client[R]
tmpl[R]
Public Instance Methods
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 125 def hash [fully_qualified_rel, tmpl.pattern, templated?].hash end
raw_href()
click to toggle source
# File lib/hal_client/link.rb, line 106 def raw_href tmpl end
target(vars = {})
click to toggle source
# 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 = {})
click to toggle source
# File lib/hal_client/link.rb, line 114 def target_url(vars = {}) tmpl.expand(vars) end
templated?()
click to toggle source
# File lib/hal_client/link.rb, line 110 def templated? true end
Protected Instance Methods
post_initialize(template:, hal_client:)
click to toggle source
# File lib/hal_client/link.rb, line 100 def post_initialize(template:, hal_client:) fail(ArgumentError) unless template.kind_of? Addressable::Template @tmpl = template @hal_client = hal_client end