Module: EntitySchema::ClassMethods
- Defined in:
- lib/entity_schema/class_methods.rb
Overview
Define empty schema or child schema from superchass schema
Instance Method Summary collapse
-
#entity_schema ⇒ Object
rubocop:disable Metrics/MethodLength:.
Instance Method Details
#entity_schema ⇒ Object
rubocop:disable Metrics/MethodLength:
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# 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 |