Module: JSON::SchemaDsl::AstNode::ClassMethods

Defined in:
lib/json/schema_dsl/ast_node.rb

Overview

The class methods that ast nodes should have

Instance Method Summary collapse

Instance Method Details

#builderClass

Override this to set a custom builder for your type.

Returns:

  • (Class)

    A new builder class for this type.



48
49
50
# File 'lib/json/schema_dsl/ast_node.rb', line 48

def builder
  ::JSON::SchemaDsl::Builder.define_builder(self)
end

#infer_typeString Also known as: type_method_name

Returns The type that will be used in I.E. ‘type: ’object’‘ attributes. Also used to give names to the dsl and builder methods.

Returns:

  • (String)

    The type that will be used in I.E. ‘type: ’object’‘ attributes. Also used to give names to the dsl and builder methods.



37
38
39
40
# File 'lib/json/schema_dsl/ast_node.rb', line 37

def infer_type
  type = name.split('::').last.underscore
  type == 'entity' ? nil : type
end