class TapRep::Schema::Types

Models JSON Schema types

Public Class Methods

datetime(*args) click to toggle source
# File lib/schema.rb, line 38
def self.datetime(*args)
  args << :datetime
  string(*args)
end
method_missing(method, *args) click to toggle source
Calls superclass method
# File lib/schema.rb, line 16
def self.method_missing(method, *args)
  return super unless %I[
    array
    number
    object
    string
  ].include?(method)

  types = [method.to_sym]
  types << :null unless args.include?(:not_null)

  {
    type: types.one? ? types.first : types
  }.tap do |hash|
    hash[:format] = 'date-time' if args.include?(:datetime)
  end
end
respond_to_missing?(_method, *_args) click to toggle source
# File lib/schema.rb, line 34
def self.respond_to_missing?(_method, *_args)
  true
end