Class: TapRep::Schema::Types
- Inherits:
-
Object
- Object
- TapRep::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
38 39 40 41 |
# File 'lib/schema.rb', line 38 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 |
# 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) ⇒ Boolean
34 35 36 |
# File 'lib/schema.rb', line 34 def self.respond_to_missing?(_method, *_args) true end |