Class: MockSuey::MethodCall
- Inherits:
-
Struct
- Object
- Struct
- MockSuey::MethodCall
- Defined in:
- lib/mock_suey/method_call.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
Returns the value of attribute arguments.
-
#has_kwargs ⇒ Object
Returns the value of attribute has_kwargs.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#method_name ⇒ Object
Returns the value of attribute method_name.
-
#receiver_class ⇒ Object
Returns the value of attribute receiver_class.
-
#return_value ⇒ Object
Returns the value of attribute return_value.
Instance Method Summary collapse
-
#initialize ⇒ MethodCall
constructor
A new instance of MethodCall.
- #inspect ⇒ Object
- #kwargs ⇒ Object
- #method_desc ⇒ Object
- #pos_args ⇒ Object
Constructor Details
#initialize ⇒ MethodCall
Returns a new instance of MethodCall.
17 18 19 20 |
# File 'lib/mock_suey/method_call.rb', line 17 def initialize(**) super self. = {} unless end |
Instance Attribute Details
#arguments ⇒ Object
Returns the value of attribute arguments
8 9 10 |
# File 'lib/mock_suey/method_call.rb', line 8 def arguments @arguments end |
#has_kwargs ⇒ Object
Returns the value of attribute has_kwargs
8 9 10 |
# File 'lib/mock_suey/method_call.rb', line 8 def has_kwargs @has_kwargs end |
#metadata ⇒ Object
Returns the value of attribute metadata
8 9 10 |
# File 'lib/mock_suey/method_call.rb', line 8 def @metadata end |
#method_name ⇒ Object
Returns the value of attribute method_name
8 9 10 |
# File 'lib/mock_suey/method_call.rb', line 8 def method_name @method_name end |
#receiver_class ⇒ Object
Returns the value of attribute receiver_class
8 9 10 |
# File 'lib/mock_suey/method_call.rb', line 8 def receiver_class @receiver_class end |
#return_value ⇒ Object
Returns the value of attribute return_value
8 9 10 |
# File 'lib/mock_suey/method_call.rb', line 8 def return_value @return_value end |
Instance Method Details
#inspect ⇒ Object
58 59 60 |
# File 'lib/mock_suey/method_call.rb', line 58 def inspect "#{method_desc}(#{arguments.map(&:inspect).join(", ")}) -> #{return_value.inspect}" end |
#kwargs ⇒ Object
28 29 30 31 |
# File 'lib/mock_suey/method_call.rb', line 28 def kwargs return {} unless has_kwargs arguments.last end |
#method_desc ⇒ Object
52 53 54 55 56 |
# File 'lib/mock_suey/method_call.rb', line 52 def method_desc delimeter = receiver_class.singleton_class? ? "." : "#" "#{receiver_class.instance_class_name}#{delimeter}#{method_name}" end |
#pos_args ⇒ Object
22 23 24 25 26 |
# File 'lib/mock_suey/method_call.rb', line 22 def pos_args return arguments unless has_kwargs *positional, _kwarg = arguments positional end |