class Compact::Invocation

Attributes

args[R]
method[R]
returns[R]

Public Class Methods

new( method:, args:, returns:) click to toggle source
# File lib/compact/invocation.rb, line 4
def initialize( method:, args:,  returns:)
  @method = method
  @args = args
  @returns = returns
end

Public Instance Methods

==(other_invocation) click to toggle source
# File lib/compact/invocation.rb, line 10
def == other_invocation
  same_returns = returns == other_invocation.returns
  matches_call(other_invocation) && same_returns
end
describe() click to toggle source
# File lib/compact/invocation.rb, line 29
    def describe
      <<~DESCRIPTION
      method: #{method}
      invoke with: #{args.inspect}
      returns: #{returns}
      DESCRIPTION
    end
eql?(other_invocation) click to toggle source
# File lib/compact/invocation.rb, line 15
def eql? other_invocation
  self.== other_invocation
end
hash() click to toggle source
# File lib/compact/invocation.rb, line 19
def hash
  describe.hash
end
matches_call(other_invocation) click to toggle source
# 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