Class: ChatgptRb::Parameter
- Inherits:
-
Object
- Object
- ChatgptRb::Parameter
- Defined in:
- lib/chatgpt_rb/parameter.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#enum ⇒ Object
Returns the value of attribute enum.
-
#name ⇒ Object
Returns the value of attribute name.
-
#required ⇒ Object
Returns the value of attribute required.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#as_json ⇒ Object
Hash.
-
#initialize(name:, enum: nil, type: nil, description: nil, required: false) ⇒ Parameter
constructor
A new instance of Parameter.
- #required? ⇒ Boolean
Constructor Details
#initialize(name:, enum: nil, type: nil, description: nil, required: false) ⇒ Parameter
Returns a new instance of Parameter.
10 11 12 13 14 15 16 |
# File 'lib/chatgpt_rb/parameter.rb', line 10 def initialize(name:, enum: nil, type: nil, description: nil, required: false) @name = name @enum = enum @type = type @description = description @required = required end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/chatgpt_rb/parameter.rb', line 3 def description @description end |
#enum ⇒ Object
Returns the value of attribute enum.
3 4 5 |
# File 'lib/chatgpt_rb/parameter.rb', line 3 def enum @enum end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/chatgpt_rb/parameter.rb', line 3 def name @name end |
#required ⇒ Object
Returns the value of attribute required.
3 4 5 |
# File 'lib/chatgpt_rb/parameter.rb', line 3 def required @required end |
#type ⇒ Object
Returns the value of attribute type.
3 4 5 |
# File 'lib/chatgpt_rb/parameter.rb', line 3 def type @type end |
Instance Method Details
#as_json ⇒ Object
Returns Hash.
23 24 25 26 27 28 29 |
# File 'lib/chatgpt_rb/parameter.rb', line 23 def as_json { enum:, type:, description:, }.compact end |
#required? ⇒ Boolean
18 19 20 |
# File 'lib/chatgpt_rb/parameter.rb', line 18 def required? !!required end |