Class: ROM::HTTP::Schema

Inherits:
Schema
  • Object
show all
Defined in:
lib/rom/http/schema.rb,
lib/rom/http/schema/dsl.rb

Defined Under Namespace

Classes: DSL

Instance Method Summary collapse

Instance Method Details

#finalize_associations!(relations:) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Internal hook used during setup process



31
32
33
34
35
36
37
# File 'lib/rom/http/schema.rb', line 31

def finalize_associations!(relations:)
  super do
    associations.map do |definition|
      HTTP::Associations.const_get(definition.type).new(definition, relations)
    end
  end
end

#qualifiedObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

To maintain compatibility with other adapters



22
23
24
# File 'lib/rom/http/schema.rb', line 22

def qualified
  self
end

#to_output_hashObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Customized output hash constructor which symbolizes keys and optionally applies custom read-type coercions



13
14
15
16
17
# File 'lib/rom/http/schema.rb', line 13

def to_output_hash
  Types::Hash
    .schema(map { |attr| [attr.key, attr.to_read_type] }.to_h)
    .with_key_transform(&:to_sym)
end