Module: JSON::SchemaBuilder::DSL::ClassMethods

Defined in:
lib/json/schema_builder/dsl.rb

Instance Method Summary collapse

Instance Method Details

#register(type) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/json/schema_builder/dsl.rb', line 36

def register(type)
  self.registered_type = type
  DSL.types ||= { }
  DSL.types[type] = self

  DSL.module_eval do
    define_method type do |*args, &block|
      opts = args.extract_options!
      name = args.first
      entity type, name, opts, &block
    end
  end
end