Class: BugBunny::Resource::ExchangeScope
- Inherits:
-
Object
- Object
- BugBunny::Resource::ExchangeScope
- Defined in:
- lib/bug_bunny/resource.rb
Instance Attribute Summary collapse
-
#exchange_name ⇒ Object
readonly
Returns the value of attribute exchange_name.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#routing_key ⇒ Object
readonly
Returns the value of attribute routing_key.
Instance Method Summary collapse
-
#initialize(klass, exchange_name, routing_key = nil) ⇒ ExchangeScope
constructor
A new instance of ExchangeScope.
- #method_missing(method_name, *args, **kwargs, &block) ⇒ Object
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
Constructor Details
#initialize(klass, exchange_name, routing_key = nil) ⇒ ExchangeScope
Returns a new instance of ExchangeScope.
26 27 28 29 30 |
# File 'lib/bug_bunny/resource.rb', line 26 def initialize(klass, exchange_name, routing_key = nil) @klass = klass @exchange_name = exchange_name @routing_key = routing_key end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, **kwargs, &block) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/bug_bunny/resource.rb', line 32 def method_missing(method_name, *args, **kwargs, &block) if @klass.respond_to?(method_name, true) kwargs[:exchange] = @exchange_name kwargs[:routing_key] = @routing_key if @routing_key.present? @klass.execute(method_name.to_sym, *args, **kwargs, &block) else super end end |
Instance Attribute Details
#exchange_name ⇒ Object (readonly)
Returns the value of attribute exchange_name.
24 25 26 |
# File 'lib/bug_bunny/resource.rb', line 24 def exchange_name @exchange_name end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
24 25 26 |
# File 'lib/bug_bunny/resource.rb', line 24 def klass @klass end |
#routing_key ⇒ Object (readonly)
Returns the value of attribute routing_key.
24 25 26 |
# File 'lib/bug_bunny/resource.rb', line 24 def routing_key @routing_key end |
Instance Method Details
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
42 43 44 |
# File 'lib/bug_bunny/resource.rb', line 42 def respond_to_missing?(method_name, include_private = false) @klass.respond_to?(method_name, true) || super end |