Class: OmniAI::Schema::Base
- Inherits:
-
Object
- Object
- OmniAI::Schema::Base
- Defined in:
- lib/omniai/schema/base.rb
Overview
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(title: nil, description: nil, nullable: nil) ⇒ Base
constructor
A new instance of Base.
- #nonnullable ⇒ Object
- #nullable ⇒ OmniAI::Schema::Base
- #nullable? ⇒ Boolean
-
#parse(value) ⇒ Object
Object.
- #serialize(additional_properties: false) ⇒ Hash
Constructor Details
#initialize(title: nil, description: nil, nullable: nil) ⇒ Base
Returns a new instance of Base.
21 22 23 24 25 26 |
# File 'lib/omniai/schema/base.rb', line 21 def initialize(title: nil, description: nil, nullable: nil) super() @title = title @description = description @nullable = nullable end |
Instance Attribute Details
#description ⇒ String?
16 17 18 |
# File 'lib/omniai/schema/base.rb', line 16 def description @description end |
#title ⇒ String?
12 13 14 |
# File 'lib/omniai/schema/base.rb', line 12 def title @title end |
Class Method Details
.deserialize(data) ⇒ OmniAI::Schema::Base
44 45 46 |
# File 'lib/omniai/schema/base.rb', line 44 def self.deserialize(data) raise NotImplementedError, ".deserialize undefined" end |
Instance Method Details
#nonnullable ⇒ Object
60 61 62 63 64 |
# File 'lib/omniai/schema/base.rb', line 60 def nonnullable dup.tap do |object| object.nullable = false end end |
#nullable ⇒ OmniAI::Schema::Base
54 55 56 57 58 |
# File 'lib/omniai/schema/base.rb', line 54 def nullable dup.tap do |object| object.nullable = true end end |
#nullable? ⇒ Boolean
49 50 51 |
# File 'lib/omniai/schema/base.rb', line 49 def nullable? !!@nullable end |
#parse(value) ⇒ Object
Returns Object.
30 31 32 |
# File 'lib/omniai/schema/base.rb', line 30 def parse(value) raise NotImplementedError, "#parse undefined" end |
#serialize(additional_properties: false) ⇒ Hash
37 38 39 |
# File 'lib/omniai/schema/base.rb', line 37 def serialize(additional_properties: false) raise NotImplementedError, "#serialize undefined" end |