Class: Ask::MCP::Native::Messages::Notification
- Inherits:
-
Object
- Object
- Ask::MCP::Native::Messages::Notification
- Defined in:
- lib/ask/mcp/native/messages.rb
Instance Attribute Summary collapse
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(method:, params: nil) ⇒ Notification
constructor
A new instance of Notification.
- #to_h ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(method:, params: nil) ⇒ Notification
Returns a new instance of Notification.
37 38 39 40 |
# File 'lib/ask/mcp/native/messages.rb', line 37 def initialize(method:, params: nil) @method = method @params = params end |
Instance Attribute Details
#method ⇒ Object (readonly)
Returns the value of attribute method.
35 36 37 |
# File 'lib/ask/mcp/native/messages.rb', line 35 def method @method end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
35 36 37 |
# File 'lib/ask/mcp/native/messages.rb', line 35 def params @params end |
Instance Method Details
#to_h ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/ask/mcp/native/messages.rb', line 42 def to_h h = { jsonrpc: JSON_RPC_VERSION, method: @method } h[:params] = @params if @params h end |
#to_json(*args) ⇒ Object
51 52 53 |
# File 'lib/ask/mcp/native/messages.rb', line 51 def to_json(*args) to_h.to_json(*args) end |