Class: Lutaml::Hal::Link

Inherits:
Model::Serializable
  • Object
show all
Defined in:
lib/lutaml/hal/link.rb

Overview

HAL Link representation with realization capability

Instance Method Summary collapse

Instance Method Details

#realize(register: nil) ⇒ Object

Fetch the actual resource this link points to. This method will use the global register according to the source of the Link object. If the Link does not have a register, a register needs to be provided explicitly via the ‘register:` parameter.



27
28
29
30
31
32
33
# File 'lib/lutaml/hal/link.rb', line 27

def realize(register: nil)
  register = find_register(register)
  raise "No register provided for link resolution (class: #{self.class}, href: #{href})" if register.nil?

  Hal.debug_log "Resolving link href: #{href} using register"
  register.resolve_and_cast(self, href)
end