Class: ConvenientService::Service::Plugins::CanHaveStubbedResults::Commands::SetServiceStubbedResult
- Inherits:
-
ConvenientService::Support::Command
- Object
- ConvenientService::Support::Command
- ConvenientService::Service::Plugins::CanHaveStubbedResults::Commands::SetServiceStubbedResult
- Defined in:
- lib/convenient_service/service/plugins/can_have_stubbed_results/commands/set_service_stubbed_result.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
Instance Method Summary collapse
- #call ⇒ ConvenientService::Service::Plugins::HasJSendResult::Entities::Result
- #initialize(service:, arguments:, result:) ⇒ void constructor
Methods inherited from ConvenientService::Support::Command
Constructor Details
#initialize(service:, arguments:, result:) ⇒ void
38 39 40 41 42 |
# File 'lib/convenient_service/service/plugins/can_have_stubbed_results/commands/set_service_stubbed_result.rb', line 38 def initialize(service:, arguments:, result:) @service = service @arguments = arguments @result = result end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
24 25 26 |
# File 'lib/convenient_service/service/plugins/can_have_stubbed_results/commands/set_service_stubbed_result.rb', line 24 def arguments @arguments end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
30 31 32 |
# File 'lib/convenient_service/service/plugins/can_have_stubbed_results/commands/set_service_stubbed_result.rb', line 30 def result @result end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
18 19 20 |
# File 'lib/convenient_service/service/plugins/can_have_stubbed_results/commands/set_service_stubbed_result.rb', line 18 def service @service end |
Instance Method Details
#call ⇒ ConvenientService::Service::Plugins::HasJSendResult::Entities::Result
50 51 52 53 54 55 56 |
# File 'lib/convenient_service/service/plugins/can_have_stubbed_results/commands/set_service_stubbed_result.rb', line 50 def call if arguments.nil? cache.default = result else cache.write(cache.keygen(*arguments.args, **arguments.kwargs, &arguments.block), result) end end |