Class: Meta::Entity

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/meta/entity.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.schema_builderObject (readonly)

Returns the value of attribute schema_builder.



12
13
14
# File 'lib/meta/entity.rb', line 12

def schema_builder
  @schema_builder
end

Class Method Details

.inherited(base) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/meta/entity.rb', line 14

def inherited(base)
  base.instance_eval do
    @schema_builder = JsonSchema::ObjectSchemaBuilder.new
    if self.name
      mod_names = self.name.split("::")
      mod_names.shift if mod_names.first == "Entities"
      schema_name = mod_names.join('_')
      @schema_builder.schema_name(schema_name)
    end
  end
end

.method_missing(method, *args, **kwargs) ⇒ Object



26
27
28
# File 'lib/meta/entity.rb', line 26

def method_missing(method, *args, **kwargs, &)
  schema_builder.send(method, *args, **kwargs, &)
end