Class: TapClutch::Schema::Types
- Inherits:
-
Object
- Object
- TapClutch::Schema::Types
- Defined in:
- lib/schema.rb
Overview
Models JSON Schema types
Class Method Summary collapse
- .datetime(*args) ⇒ Object
- .method_missing(method, *args) ⇒ Object
- .respond_to_missing?(_method, *_args) ⇒ Boolean
Class Method Details
.datetime(*args) ⇒ Object
39 40 41 42 |
# File 'lib/schema.rb', line 39 def self.datetime(*args) args << :datetime string(*args) end |
.method_missing(method, *args) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/schema.rb', line 16 def self.method_missing(method, *args) return super unless %I[ array number object string boolean ].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) ⇒ Boolean
35 36 37 |
# File 'lib/schema.rb', line 35 def self.respond_to_missing?(_method, *_args) true end |