Class: Mocktail::Call
- Inherits:
-
T::Struct
- Object
- T::Struct
- Mocktail::Call
- Extended by:
- T::Sig
- Defined in:
- lib/mocktail/value/call.rb,
lib/mocktail/sorbet/mocktail/value/call.rb
Instance Attribute Summary collapse
-
#method ⇒ Object
readonly
Returns the value of attribute method.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Because T::Struct compares with referential equality, we need to redefine the equality methods to compare the values of the attributes.
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
Instance Attribute Details
#method ⇒ Object (readonly)
Returns the value of attribute method.
19 20 21 |
# File 'lib/mocktail/value/call.rb', line 19 def method @method end |
Instance Method Details
#==(other) ⇒ Object
Because T::Struct compares with referential equality, we need to redefine the equality methods to compare the values of the attributes.
24 25 26 |
# File 'lib/mocktail/value/call.rb', line 24 def ==(other) eql?(other) end |
#eql?(other) ⇒ Boolean
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/mocktail/value/call.rb', line 28 def eql?(other) case other when Call [ :singleton, :double, :original_type, :dry_type, :method, :original_method, :args, :kwargs, :block ].all? { |attr| instance_variable_get("@#{attr}") == other.send(attr) } else false end end |
#hash ⇒ Object
42 43 44 |
# File 'lib/mocktail/value/call.rb', line 42 def hash [@singleton, @double, @original_type, @dry_type, @method, @original_method, @args, @kwargs, @block].hash end |