Class: Corindon::DependencyInjection::Token::ServiceCallToken
- Inherits:
-
InjectionToken
- Object
- InjectionToken
- Corindon::DependencyInjection::Token::ServiceCallToken
- Defined in:
- lib/corindon/dependency_injection/token/service_call_token.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#kwargs ⇒ Object
readonly
Returns the value of attribute kwargs.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
Instance Method Summary collapse
- #call(method, *args, **kwargs) ⇒ Object
-
#initialize(service:) ⇒ ServiceCallToken
constructor
A new instance of ServiceCallToken.
- #resolve(injector:) ⇒ Object
Constructor Details
#initialize(service:) ⇒ ServiceCallToken
Returns a new instance of ServiceCallToken.
12 13 14 15 16 17 18 |
# File 'lib/corindon/dependency_injection/token/service_call_token.rb', line 12 def initialize(service:) super() @service = service @args = [] @kwargs = {} end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
9 10 11 |
# File 'lib/corindon/dependency_injection/token/service_call_token.rb', line 9 def args @args end |
#kwargs ⇒ Object (readonly)
Returns the value of attribute kwargs.
10 11 12 |
# File 'lib/corindon/dependency_injection/token/service_call_token.rb', line 10 def kwargs @kwargs end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
8 9 10 |
# File 'lib/corindon/dependency_injection/token/service_call_token.rb', line 8 def method @method end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
7 8 9 |
# File 'lib/corindon/dependency_injection/token/service_call_token.rb', line 7 def service @service end |
Instance Method Details
#call(method, *args, **kwargs) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/corindon/dependency_injection/token/service_call_token.rb', line 20 def call(method, *args, **kwargs) @method = method @args = args @kwargs = kwargs self end |
#resolve(injector:) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/corindon/dependency_injection/token/service_call_token.rb', line 29 def resolve(injector:) RubyCompat.do_call( injector.resolve(service), method, injector.resolve(args), injector.resolve(kwargs) ) end |