Class: Compact::Invocation
- Inherits:
-
Object
- Object
- Compact::Invocation
- Defined in:
- lib/compact/invocation.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#returns ⇒ Object
readonly
Returns the value of attribute returns.
Instance Method Summary collapse
- #==(other_invocation) ⇒ Object
- #describe ⇒ Object
- #eql?(other_invocation) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(method:, args:, returns:) ⇒ Invocation
constructor
A new instance of Invocation.
- #matches_call(other_invocation) ⇒ Object
Constructor Details
#initialize(method:, args:, returns:) ⇒ Invocation
Returns a new instance of Invocation.
4 5 6 7 8 |
# File 'lib/compact/invocation.rb', line 4 def initialize( method:, args:, returns:) @method = method @args = args @returns = returns end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
3 4 5 |
# File 'lib/compact/invocation.rb', line 3 def args @args end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
3 4 5 |
# File 'lib/compact/invocation.rb', line 3 def method @method end |
#returns ⇒ Object (readonly)
Returns the value of attribute returns.
3 4 5 |
# File 'lib/compact/invocation.rb', line 3 def returns @returns end |
Instance Method Details
#==(other_invocation) ⇒ Object
10 11 12 13 |
# File 'lib/compact/invocation.rb', line 10 def == other_invocation same_returns = returns == other_invocation.returns matches_call(other_invocation) && same_returns end |
#describe ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/compact/invocation.rb', line 29 def describe <<~DESCRIPTION method: #{method} invoke with: #{args.inspect} returns: #{returns} DESCRIPTION end |
#eql?(other_invocation) ⇒ Boolean
15 16 17 |
# File 'lib/compact/invocation.rb', line 15 def eql? other_invocation self.== other_invocation end |
#hash ⇒ Object
19 20 21 |
# File 'lib/compact/invocation.rb', line 19 def hash describe.hash end |
#matches_call(other_invocation) ⇒ Object
23 24 25 26 27 |
# File 'lib/compact/invocation.rb', line 23 def matches_call(other_invocation) same_args = args == other_invocation.args same_method = method == other_invocation.method same_args && same_method end |