Class: StimulusPlumbers::Components::Plumber::Dispatcher::KlassProxy
- Inherits:
-
Object
- Object
- StimulusPlumbers::Components::Plumber::Dispatcher::KlassProxy
- Defined in:
- lib/stimulus_plumbers/components/plumber/dispatcher.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#init_args ⇒ Object
readonly
Returns the value of attribute init_args.
-
#init_kwargs ⇒ Object
readonly
Returns the value of attribute init_kwargs.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#kwargs ⇒ Object
readonly
Returns the value of attribute kwargs.
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
Instance Method Summary collapse
- #call(_target) ⇒ Object
-
#initialize(klass, method_name, *args, init_args: [], init_kwargs: {}, **kwargs) ⇒ KlassProxy
constructor
A new instance of KlassProxy.
Constructor Details
#initialize(klass, method_name, *args, init_args: [], init_kwargs: {}, **kwargs) ⇒ KlassProxy
Returns a new instance of KlassProxy.
71 72 73 74 75 76 77 78 79 |
# File 'lib/stimulus_plumbers/components/plumber/dispatcher.rb', line 71 def initialize(klass, method_name, *args, init_args: [], init_kwargs: {}, **kwargs) @klass = klass @method_name = method_name @args = args @kwargs = kwargs @init_args = init_args @init_kwargs = init_kwargs validate! end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
69 70 71 |
# File 'lib/stimulus_plumbers/components/plumber/dispatcher.rb', line 69 def args @args end |
#init_args ⇒ Object (readonly)
Returns the value of attribute init_args.
69 70 71 |
# File 'lib/stimulus_plumbers/components/plumber/dispatcher.rb', line 69 def init_args @init_args end |
#init_kwargs ⇒ Object (readonly)
Returns the value of attribute init_kwargs.
69 70 71 |
# File 'lib/stimulus_plumbers/components/plumber/dispatcher.rb', line 69 def init_kwargs @init_kwargs end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
69 70 71 |
# File 'lib/stimulus_plumbers/components/plumber/dispatcher.rb', line 69 def klass @klass end |
#kwargs ⇒ Object (readonly)
Returns the value of attribute kwargs.
69 70 71 |
# File 'lib/stimulus_plumbers/components/plumber/dispatcher.rb', line 69 def kwargs @kwargs end |
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
69 70 71 |
# File 'lib/stimulus_plumbers/components/plumber/dispatcher.rb', line 69 def method_name @method_name end |
Instance Method Details
#call(_target) ⇒ Object
81 82 83 |
# File 'lib/stimulus_plumbers/components/plumber/dispatcher.rb', line 81 def call(_target) klass.new(*init_args, **init_kwargs).public_send(method_name, *args, **kwargs) end |