Class: Lamby::ProxyContext
- Inherits:
-
Object
- Object
- Lamby::ProxyContext
- Defined in:
- lib/lamby/proxy_context.rb
Overview
This class is used by the ‘lamby:proxy_server` Rake task to run a Rack server for local development proxy. Specifically, this class accepts a JSON respresentation of a Lambda context object converted to a Hash as the single arugment.
Instance Method Summary collapse
-
#initialize(data) ⇒ ProxyContext
constructor
A new instance of ProxyContext.
- #method_missing(method_name, *args, &block) ⇒ Object
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
Constructor Details
#initialize(data) ⇒ ProxyContext
Returns a new instance of ProxyContext.
8 9 10 |
# File 'lib/lamby/proxy_context.rb', line 8 def initialize(data) @data = data end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/lamby/proxy_context.rb', line 12 def method_missing(method_name, *args, &block) key = method_name.to_s if @data.key?(key) @data[key] else super end end |
Instance Method Details
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
21 22 23 |
# File 'lib/lamby/proxy_context.rb', line 21 def respond_to_missing?(method_name, include_private = false) @data.key?(method_name.to_s) || super end |