Class: MockSuey::MethodCall

Inherits:
Struct
  • Object
show all
Defined in:
lib/mock_suey/method_call.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMethodCall

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

#argumentsObject

Returns the value of attribute arguments

Returns:

  • (Object)

    the current value of arguments



8
9
10
# File 'lib/mock_suey/method_call.rb', line 8

def arguments
  @arguments
end

#has_kwargsObject

Returns the value of attribute has_kwargs

Returns:

  • (Object)

    the current value of has_kwargs



8
9
10
# File 'lib/mock_suey/method_call.rb', line 8

def has_kwargs
  @has_kwargs
end

#metadataObject

Returns the value of attribute metadata

Returns:

  • (Object)

    the current value of metadata



8
9
10
# File 'lib/mock_suey/method_call.rb', line 8

def 
  @metadata
end

#method_nameObject

Returns the value of attribute method_name

Returns:

  • (Object)

    the current value of method_name



8
9
10
# File 'lib/mock_suey/method_call.rb', line 8

def method_name
  @method_name
end

#receiver_classObject

Returns the value of attribute receiver_class

Returns:

  • (Object)

    the current value of receiver_class



8
9
10
# File 'lib/mock_suey/method_call.rb', line 8

def receiver_class
  @receiver_class
end

#return_valueObject

Returns the value of attribute return_value

Returns:

  • (Object)

    the current value of return_value



8
9
10
# File 'lib/mock_suey/method_call.rb', line 8

def return_value
  @return_value
end

Instance Method Details

#inspectObject



58
59
60
# File 'lib/mock_suey/method_call.rb', line 58

def inspect
  "#{method_desc}(#{arguments.map(&:inspect).join(", ")}) -> #{return_value.inspect}"
end

#kwargsObject



28
29
30
31
# File 'lib/mock_suey/method_call.rb', line 28

def kwargs
  return {} unless has_kwargs
  arguments.last
end

#method_descObject



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_argsObject



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