Class: Dtn::Streaming::RequestBuilder::Proxy
- Inherits:
-
Object
- Object
- Dtn::Streaming::RequestBuilder::Proxy
- Defined in:
- lib/dtn/streaming/request_builder.rb
Overview
Proxy class between builder and request
Instance Method Summary collapse
-
#initialize(client:, requests_module:) ⇒ Proxy
constructor
A new instance of Proxy.
- #method_missing(method_name, *args, **opts, &blk) ⇒ Object
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
Constructor Details
#initialize(client:, requests_module:) ⇒ Proxy
Returns a new instance of Proxy.
9 10 11 12 |
# File 'lib/dtn/streaming/request_builder.rb', line 9 def initialize(client:, requests_module:) @client = client @requests_module = requests_module end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, **opts, &blk) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/dtn/streaming/request_builder.rb', line 14 def method_missing(method_name, *args, **opts, &blk) req = requests_module.const_get(method_name.to_s.camelize).new(client: client) req.call(*args, **opts, &blk) rescue NameError super end |
Instance Method Details
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
21 22 23 24 25 |
# File 'lib/dtn/streaming/request_builder.rb', line 21 def respond_to_missing?(method_name, include_private = false) requests_module.const_get(method_name.to_s.camelize).is_a? Module rescue NameError super end |