Class: Lutaml::Hal::Link
- Inherits:
-
Model::Serializable
- Object
- Model::Serializable
- Lutaml::Hal::Link
- Defined in:
- lib/lutaml/hal/link.rb
Overview
HAL Link representation with realization capability
Instance Method Summary collapse
-
#realize(register: nil, parent_resource: nil) ⇒ Object
Fetch the actual resource this link points to.
Instance Method Details
#realize(register: nil, parent_resource: 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 34 35 36 37 38 |
# File 'lib/lutaml/hal/link.rb', line 27 def realize(register: nil, parent_resource: nil) # First check if embedded content is available if parent_resource && ( = (parent_resource, register)) return end 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 |