Class: Mocktail::Matchers::Captor::Capture

Inherits:
Base
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/mocktail/matchers/captor.rb,
lib/mocktail/sorbet/mocktail/matchers/captor.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#is_mocktail_matcher?

Constructor Details

#initializeCapture

Returns a new instance of Capture.



27
28
29
30
# File 'lib/mocktail/matchers/captor.rb', line 27

def initialize
  @value = nil
  @captured = false
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



25
26
27
# File 'lib/mocktail/matchers/captor.rb', line 25

def value
  @value
end

Class Method Details

.matcher_nameObject



21
22
23
# File 'lib/mocktail/matchers/captor.rb', line 21

def self.matcher_name
  :capture
end

Instance Method Details

#captured?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/mocktail/matchers/captor.rb', line 38

def captured?
  @captured
end

#inspectObject



42
43
44
# File 'lib/mocktail/matchers/captor.rb', line 42

def inspect
  "capture"
end

#match?(actual) ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
35
36
# File 'lib/mocktail/matchers/captor.rb', line 32

def match?(actual)
  @value = actual
  @captured = true
  true
end