Class: ConvenientService::RSpec::PrimitiveMatchers::Classes::DelegateTo::Entities::Inputs
- Inherits:
-
Object
- Object
- ConvenientService::RSpec::PrimitiveMatchers::Classes::DelegateTo::Entities::Inputs
- Defined in:
- lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/inputs.rb
Instance Attribute Summary collapse
- #values ⇒ Object readonly private
Instance Method Summary collapse
- #==(other) ⇒ Boolean? private
- #block_expectation ⇒ Proc? private
- #block_expectation=(block) ⇒ Proc private
-
#custom_return_value ⇒ Object
private
Can be any type.
-
#delegation_value ⇒ Object
private
Can be any type.
- #expected_arguments ⇒ ConvenientService::Support::Arguments private
- #expected_arguments=(arguments) ⇒ ConvenientService::Support::Arguments private
- #expected_return_value_block ⇒ Proc private
- #has_call_original? ⇒ Boolean private
- #initialize(object:, method:, block_expectation:) ⇒ void constructor private
- #method ⇒ String, Symbol private
-
#object ⇒ Object
private
Can be any type.
- #printable_block_expectation ⇒ String private
- #printable_method ⇒ String private
- #should_call_original=(flag) ⇒ Boolean private
- #should_call_original? ⇒ Boolean private
- #update_expected_return_value_block(*args, &block) ⇒ Proc private
Constructor Details
#initialize(object:, method:, block_expectation:) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
31 32 33 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/inputs.rb', line 31 def initialize(object:, method:, block_expectation:) @values = {object: object, method: method, block_expectation: block_expectation} end |
Instance Attribute Details
#values ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/inputs.rb', line 21 def values @values end |
Instance Method Details
#==(other) ⇒ Boolean?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
294 295 296 297 298 299 300 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/inputs.rb', line 294 def ==(other) return unless other.instance_of?(self.class) return false if values != other.values true end |
#block_expectation ⇒ Proc?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
40 41 42 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/inputs.rb', line 40 def block_expectation values[:block_expectation] end |
#block_expectation=(block) ⇒ Proc
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
236 237 238 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/inputs.rb', line 236 def block_expectation=(block) values[:block_expectation] = block end |
#custom_return_value ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Can be any type.
52 53 54 55 56 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/inputs.rb', line 52 def custom_return_value return values[:custom_return_value] if values.has_key?(:custom_return_value) values[:custom_return_value] = expected_return_value_block.call(delegation_value) end |
#delegation_value ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Can be any type.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/inputs.rb', line 118 def delegation_value return values[:delegation_value] if values.has_key?(:delegation_value) values[:delegation_value] = case when expected_arguments.args.any? && expected_arguments.kwargs.any? && expected_arguments.block object.__send__(method, *expected_arguments.args, **expected_arguments.kwargs, &expected_arguments.block) when expected_arguments.args.any? && expected_arguments.kwargs.any? && !expected_arguments.block object.__send__(method, *expected_arguments.args, **expected_arguments.kwargs) when expected_arguments.args.any? && !expected_arguments.kwargs.any? && expected_arguments.block object.__send__(method, *expected_arguments.args, &expected_arguments.block) when !expected_arguments.args.any? && expected_arguments.kwargs.any? && expected_arguments.block object.__send__(method, **expected_arguments.kwargs, &expected_arguments.block) when expected_arguments.args.any? && !expected_arguments.kwargs.any? && !expected_arguments.block object.__send__(method, *expected_arguments.args) when !expected_arguments.args.any? && expected_arguments.kwargs.any? && !expected_arguments.block object.__send__(method, **expected_arguments.kwargs) when !expected_arguments.args.any? && !expected_arguments.kwargs.any? && expected_arguments.block object.__send__(method, &expected_arguments.block) else object.__send__(method) end end |
#expected_arguments ⇒ ConvenientService::Support::Arguments
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
162 163 164 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/inputs.rb', line 162 def expected_arguments values[:expected_arguments] ||= Support::Arguments.null_arguments end |
#expected_arguments=(arguments) ⇒ ConvenientService::Support::Arguments
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
246 247 248 249 250 251 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/inputs.rb', line 246 def expected_arguments=(arguments) values.delete(:delegation_value) values.delete(:custom_return_value) values[:expected_arguments] = arguments end |
#expected_return_value_block ⇒ Proc
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
171 172 173 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/inputs.rb', line 171 def expected_return_value_block values[:expected_return_value_block] ||= proc { Support::UNDEFINED } end |
#has_call_original? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
216 217 218 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/inputs.rb', line 216 def has_call_original? values.has_key?(:should_call_original) end |
#method ⇒ String, Symbol
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
180 181 182 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/inputs.rb', line 180 def method values[:method] end |
#object ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Can be any type.
189 190 191 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/inputs.rb', line 189 def object values[:object] end |
#printable_block_expectation ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
198 199 200 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/inputs.rb', line 198 def printable_block_expectation @printable_block_expectation ||= Utils::Proc.display(block_expectation) end |
#printable_method ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
207 208 209 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/inputs.rb', line 207 def printable_method @printable_method ||= Commands::GeneratePrintableMethod.call(object: object, method: method) end |
#should_call_original=(flag) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
259 260 261 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/inputs.rb', line 259 def should_call_original=(flag) values[:should_call_original] = flag end |
#should_call_original? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
225 226 227 228 229 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/inputs.rb', line 225 def should_call_original? return values[:should_call_original] if values.has_key?(:should_call_original) values[:should_call_original] = true end |
#update_expected_return_value_block(*args, &block) ⇒ Proc
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/inputs.rb', line 270 def update_expected_return_value_block(*args, &block) values.delete(:custom_return_value) values[:expected_return_value_block] = if args.any? && block ::ConvenientService.raise Exceptions::ReturnCustomValueChainingInvalidArguments.new elsif args.any? proc { args.first } elsif block block else ::ConvenientService.raise Exceptions::ReturnCustomValueChainingInvalidArguments.new end end |