class Lutaml::Hal::Resource

def create_link_class(realize_class_name)

This is a Link class that helps us realize the targeted class
def create_link_class(realize_class_name)
  parent_klass_name = name.split('::')[0..-2].join('::')
  child_klass_name = "#{realize_class_name.split('::').last}Link"
  klass_name = [parent_klass_name, child_klass_name].join('::')
  Hal.debug_log "Creating link class #{klass_name} for #{realize_class_name}"
  return Object.const_get(klass_name) if Object.const_defined?(klass_name)
  # Define the link class dynamically
  klass = Class.new(Link) do
    # Define the link class with the specified key and class
    attribute :type, :string, default: realize_class_name
  end
  parent_klass = !parent_klass_name.empty? ? Object.const_get(parent_klass_name) : Object
  parent_klass.const_set(child_klass_name, klass)
  klass
end