module Fried::Schema::DataEntity

Includes {Struct} but also provide a {.build} method which initialize the object with a {Hash}, setting attributes based on keys

Public Class Methods

included(klass) click to toggle source
# File lib/fried/schema/data_entity.rb, line 27
def self.included(klass)
  klass.instance_eval do
    include ::Fried::Schema::Struct
    extend ClassMethods
  end
end

Public Instance Methods

to_h() click to toggle source

@return [Hash{Symbol => Object}] a hash containing the values of all

attribute name => value
# File lib/fried/schema/data_entity.rb, line 22
def to_h
  schema = GetDefinition.(self.class)
  AttributesToHash.(schema, self)
end