Class: MCP::Configuration
- Inherits:
-
Object
- Object
- MCP::Configuration
- Defined in:
- lib/mcp/configuration.rb
Constant Summary collapse
- DEFAULT_PROTOCOL_VERSION =
"2024-11-05"
Instance Attribute Summary collapse
Instance Method Summary collapse
- #exception_reporter? ⇒ Boolean
-
#initialize(exception_reporter: nil, instrumentation_callback: nil, protocol_version: nil) ⇒ Configuration
constructor
A new instance of Configuration.
- #instrumentation_callback? ⇒ Boolean
- #merge(other) ⇒ Object
- #protocol_version? ⇒ Boolean
Constructor Details
#initialize(exception_reporter: nil, instrumentation_callback: nil, protocol_version: nil) ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 13 |
# File 'lib/mcp/configuration.rb', line 9 def initialize(exception_reporter: nil, instrumentation_callback: nil, protocol_version: nil) @exception_reporter = exception_reporter @instrumentation_callback = instrumentation_callback @protocol_version = protocol_version end |
Instance Attribute Details
#exception_reporter ⇒ Object
23 24 25 |
# File 'lib/mcp/configuration.rb', line 23 def exception_reporter @exception_reporter || default_exception_reporter end |
#instrumentation_callback ⇒ Object
31 32 33 |
# File 'lib/mcp/configuration.rb', line 31 def instrumentation_callback @instrumentation_callback || default_instrumentation_callback end |
#protocol_version ⇒ Object
15 16 17 |
# File 'lib/mcp/configuration.rb', line 15 def protocol_version @protocol_version || DEFAULT_PROTOCOL_VERSION end |
Instance Method Details
#exception_reporter? ⇒ Boolean
27 28 29 |
# File 'lib/mcp/configuration.rb', line 27 def exception_reporter? !@exception_reporter.nil? end |
#instrumentation_callback? ⇒ Boolean
35 36 37 |
# File 'lib/mcp/configuration.rb', line 35 def instrumentation_callback? !@instrumentation_callback.nil? end |
#merge(other) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/mcp/configuration.rb', line 39 def merge(other) return self if other.nil? exception_reporter = if other.exception_reporter? other.exception_reporter else @exception_reporter end instrumentation_callback = if other.instrumentation_callback? other.instrumentation_callback else @instrumentation_callback end protocol_version = if other.protocol_version? other.protocol_version else @protocol_version end Configuration.new( exception_reporter:, instrumentation_callback:, protocol_version:, ) end |
#protocol_version? ⇒ Boolean
19 20 21 |
# File 'lib/mcp/configuration.rb', line 19 def protocol_version? !@protocol_version.nil? end |