module EntitySchema::ClassMethods
Define empty schema or child schema from superchass schema
Public Instance Methods
entity_schema()
click to toggle source
rubocop:disable Metrics/MethodLength:
# File lib/entity_schema/class_methods.rb, line 9 def entity_schema @entity_schema ||= begin if superclass.respond_to?(:entity_schema) superschema = superclass.entity_schema unless superschema.is_a?(Schema) raise Exception, "class-level method `#{superclass}.entity_schema` is required " \ 'by gem "entity_schema" and must return instance of ' \ "`#{Schema}`, but returns a `#{superschema.class}`" end Schema.new(owner_name: to_s, extends: superschema) else Schema.new(owner_name: to_s) end end end