Class: Ask::MCP::Prompt
- Inherits:
-
Object
- Object
- Ask::MCP::Prompt
- Defined in:
- lib/ask/mcp/prompt.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, description: nil, arguments: []) ⇒ Prompt
constructor
A new instance of Prompt.
- #to_h ⇒ Object
Constructor Details
#initialize(name:, description: nil, arguments: []) ⇒ Prompt
Returns a new instance of Prompt.
8 9 10 11 12 |
# File 'lib/ask/mcp/prompt.rb', line 8 def initialize(name:, description: nil, arguments: []) @name = name @description = description @arguments = arguments end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
6 7 8 |
# File 'lib/ask/mcp/prompt.rb', line 6 def arguments @arguments end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
6 7 8 |
# File 'lib/ask/mcp/prompt.rb', line 6 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/ask/mcp/prompt.rb', line 6 def name @name end |
Class Method Details
.from_h(hash) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/ask/mcp/prompt.rb', line 21 def self.from_h(hash) new( name: hash[:name] || hash["name"], description: hash[:description] || hash["description"], arguments: hash[:arguments] || hash["arguments"] || [] ) end |
Instance Method Details
#to_h ⇒ Object
14 15 16 17 18 19 |
# File 'lib/ask/mcp/prompt.rb', line 14 def to_h h = { name: @name } h[:description] = @description if @description h[:arguments] = @arguments if @arguments.any? h end |