Class: AbstractNotifier::Base::ParamsProxy
- Inherits:
-
Object
- Object
- AbstractNotifier::Base::ParamsProxy
- Defined in:
- lib/abstract_notifier/base.rb
Instance Attribute Summary collapse
-
#notifier_class ⇒ Object
readonly
Returns the value of attribute notifier_class.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(notifier_class, params) ⇒ ParamsProxy
constructor
A new instance of ParamsProxy.
-
#method_missing(method_name, *args, **kwargs) ⇒ Object
rubocop:disable Style/MethodMissingSuper.
-
#respond_to_missing?(*args) ⇒ Boolean
rubocop:enable Style/MethodMissingSuper.
Constructor Details
#initialize(notifier_class, params) ⇒ ParamsProxy
Returns a new instance of ParamsProxy.
31 32 33 34 |
# File 'lib/abstract_notifier/base.rb', line 31 def initialize(notifier_class, params) @notifier_class = notifier_class @params = params end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, **kwargs) ⇒ Object
rubocop:disable Style/MethodMissingSuper
37 38 39 40 41 42 43 |
# File 'lib/abstract_notifier/base.rb', line 37 def method_missing(method_name, *args, **kwargs) if kwargs.empty? notifier_class.new(method_name, **params).public_send(method_name, *args) else notifier_class.new(method_name, **params).public_send(method_name, *args, **kwargs) end end |
Instance Attribute Details
#notifier_class ⇒ Object (readonly)
Returns the value of attribute notifier_class.
29 30 31 |
# File 'lib/abstract_notifier/base.rb', line 29 def notifier_class @notifier_class end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
29 30 31 |
# File 'lib/abstract_notifier/base.rb', line 29 def params @params end |
Instance Method Details
#respond_to_missing?(*args) ⇒ Boolean
rubocop:enable Style/MethodMissingSuper
46 47 48 |
# File 'lib/abstract_notifier/base.rb', line 46 def respond_to_missing?(*args) notifier_class.respond_to_missing?(*args) end |