Class: Ask::Tool::Parameter
- Inherits:
-
Object
- Object
- Ask::Tool::Parameter
- Defined in:
- lib/ask/tools/tool.rb
Overview
Internal value object for parameter metadata.
Instance Attribute Summary collapse
- #description ⇒ String? readonly
- #name ⇒ Symbol readonly
- #required ⇒ Boolean (also: #required?) readonly
-
#type ⇒ String
readonly
JSON Schema type string.
Instance Method Summary collapse
-
#initialize(name:, type:, description: nil, required: true) ⇒ Parameter
constructor
A new instance of Parameter.
- #to_h ⇒ Hash
Constructor Details
#initialize(name:, type:, description: nil, required: true) ⇒ Parameter
Returns a new instance of Parameter.
255 256 257 258 259 260 |
# File 'lib/ask/tools/tool.rb', line 255 def initialize(name:, type:, description: nil, required: true) @name = name @type = type @description = description @required = required end |
Instance Attribute Details
#description ⇒ String? (readonly)
248 249 250 |
# File 'lib/ask/tools/tool.rb', line 248 def description @description end |
#name ⇒ Symbol (readonly)
242 243 244 |
# File 'lib/ask/tools/tool.rb', line 242 def name @name end |
#required ⇒ Boolean (readonly) Also known as: required?
251 252 253 |
# File 'lib/ask/tools/tool.rb', line 251 def required @required end |
#type ⇒ String (readonly)
Returns JSON Schema type string.
245 246 247 |
# File 'lib/ask/tools/tool.rb', line 245 def type @type end |
Instance Method Details
#to_h ⇒ Hash
263 264 265 266 267 268 269 270 |
# File 'lib/ask/tools/tool.rb', line 263 def to_h { name: name, type: type, description: description, required: required } end |