Class: Fibre::Mock
- Inherits:
-
Object
- Object
- Fibre::Mock
- Defined in:
- lib/fibre/mock.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Instance Method Summary collapse
- #completed? ⇒ Boolean
-
#initialize(scope) ⇒ Mock
constructor
A new instance of Mock.
- #leave(e, *a) ⇒ Object
- #resume(result) ⇒ Object
Constructor Details
#initialize(scope) ⇒ Mock
Returns a new instance of Mock.
7 8 9 |
# File 'lib/fibre/mock.rb', line 7 def initialize(scope) @scope = scope end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
5 6 7 |
# File 'lib/fibre/mock.rb', line 5 def path @path end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
4 5 6 |
# File 'lib/fibre/mock.rb', line 4 def result @result end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
3 4 5 |
# File 'lib/fibre/mock.rb', line 3 def scope @scope end |
Instance Method Details
#completed? ⇒ Boolean
17 18 19 |
# File 'lib/fibre/mock.rb', line 17 def completed? !!@completed end |
#leave(e, *a) ⇒ Object
21 22 23 |
# File 'lib/fibre/mock.rb', line 21 def leave(e, *a) resume e.is_a?(Class) ? e.new(*a) : e end |
#resume(result) ⇒ Object
11 12 13 14 15 |
# File 'lib/fibre/mock.rb', line 11 def resume(result) @result = result @completed = true @scope.check end |