Class: Lutaml::Hal::Page

Inherits:
Resource
  • Object
show all
Defined in:
lib/lutaml/hal/page.rb

Overview

Models the pagination of a collection of resources This class is used to represent the pagination information for a collection of resources in the HAL format.

Class Method Summary collapse

Methods inherited from Resource

get_links_class, hal_link

Class Method Details

.inherited(subclass) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/lutaml/hal/page.rb', line 23

def self.inherited(subclass)
  super

  page_links_symbols = %i[self next prev first last]
  subclass_name = subclass.name
  subclass.class_eval do
    # Define common page links
    page_links_symbols.each do |link_symbol|
      hal_link link_symbol, key: link_symbol.to_s, realize_class: subclass_name
    end
  end
end