Class: Utils::ProbeServer::LogWrapper
- Inherits:
- BasicObject
- Defined in:
- lib/utils/probe_server.rb
Instance Method Summary collapse
-
#[]=(name, value) ⇒ String
The []= method sets an environment variable value through the probe server.
-
#initialize(server, object) ⇒ LogWrapper
constructor
The initialize method sets up a new instance with the provided server object and object.
-
#method_missing(*a, &b) ⇒ Object
The method_missing method delegates calls to the wrapped object’s methods.
Constructor Details
#initialize(server, object) ⇒ LogWrapper
The initialize method sets up a new instance with the provided server object and object.
This method creates and configures a LogWrapper instance by storing references to the specified server and object parameters. It prepares the wrapper for use in logging environment variable operations while maintaining access to both the server for messaging and the underlying object for attribute access.
386 387 388 |
# File 'lib/utils/probe_server.rb', line 386 def initialize(server, object) @server, @object = server, object end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*a, &b) ⇒ Object
The method_missing method delegates calls to the wrapped object’s methods.
This method acts as a fallback handler that forwards undefined method calls to the internal object instance, enabling dynamic method dispatch while maintaining access to all available methods through the wrapper interface.
wrapped object
421 422 423 |
# File 'lib/utils/probe_server.rb', line 421 def method_missing(*a, &b) @object.__send__(*a, &b) end |
Instance Method Details
#[]=(name, value) ⇒ String
The []= method sets an environment variable value through the probe server.
This method transmits a request to the probe server to set the specified environment variable key to the given value, then returns the updated environment value from the server’s response.
the server
402 403 404 405 406 |
# File 'lib/utils/probe_server.rb', line 402 def []=(name, value) name, value = name.to_s, value.to_s @server.("Setting #{name}=#{value.inspect}.", type: :info) @object[name] = value end |