Class: Graphiti::OpenAPI::Attributes

Inherits:
Hash
  • Object
show all
Defined in:
app/models/graphiti/open_api/attribute.rb

Class Method Summary collapse

Class Method Details

.load(resource, data = ) ⇒ Object



34
35
36
37
38
# File 'app/models/graphiti/open_api/attribute.rb', line 34

def self.load(resource, data = resource.__attributes__[:attributes])
  data.each_with_object(new) do |(name, data), result|
    result[name] = Attribute.new(data.to_hash.merge(name: name, resource: resource))
  end
end