Class: Anchor::Inference::JSONAPI::Infer::AnchorDef

Inherits:
Base
  • Object
show all
Defined in:
lib/anchor/inference/jsonapi/infer/anchor_def.rb

Instance Method Summary collapse

Methods inherited from Base

infer

Constructor Details

#initialize(klass) ⇒ AnchorDef

Returns a new instance of AnchorDef.



5
6
7
8
9
10
11
12
13
# File 'lib/anchor/inference/jsonapi/infer/anchor_def.rb', line 5

def initialize(klass)
  super(klass)
  @anchor_attributes = klass.try(:anchor_attributes) || {}
  @anchor_relationships = klass.try(:anchor_relationships) || {}
  @anchor_attributes_descriptions = klass.try(:anchor_attributes_descriptions) || {}
  @anchor_relationships_descriptions = klass.try(:anchor_relationships_descriptions) || {}
  @anchor_links_schema = klass.try(:anchor_links_schema) || nil
  @anchor_meta_schema = klass.try(:anchor_meta_schema) || nil
end

Instance Method Details

#inferObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/anchor/inference/jsonapi/infer/anchor_def.rb', line 15

def infer
  object([
    id,
    type,
    *attributes,
    *relationships,
    meta,
    links,
  ].compact)
end