Class: FlexMock::PartialMockProxy::ProxyBox
- Defined in:
- lib/flexmock/partial_mock.rb
Overview
Boxing of the flexmock proxy
It is managed as a stack in order to allow to setup containers recursively (as e.g. FlexMock.use( … ) checks)
Defined Under Namespace
Classes: Element
Instance Attribute Summary collapse
-
#stack ⇒ Object
readonly
Returns the value of attribute stack.
Instance Method Summary collapse
-
#container ⇒ Object
Tests whether the given container is the one on which the current proxy acts.
- #empty? ⇒ Boolean
-
#initialize ⇒ ProxyBox
constructor
A new instance of ProxyBox.
- #pop ⇒ Object
- #proxy ⇒ Object
- #push(proxy, container) ⇒ Object
Constructor Details
Instance Attribute Details
#stack ⇒ Object (readonly)
Returns the value of attribute stack.
36 37 38 |
# File 'lib/flexmock/partial_mock.rb', line 36 def stack @stack end |
Instance Method Details
#container ⇒ Object
Tests whether the given container is the one on which the current proxy acts
46 47 48 |
# File 'lib/flexmock/partial_mock.rb', line 46 def container stack.last.container end |
#empty? ⇒ Boolean
64 65 66 |
# File 'lib/flexmock/partial_mock.rb', line 64 def empty? stack.size == 1 end |
#pop ⇒ Object
58 59 60 61 62 |
# File 'lib/flexmock/partial_mock.rb', line 58 def pop if !stack.empty? stack.pop end end |
#proxy ⇒ Object
50 51 52 |
# File 'lib/flexmock/partial_mock.rb', line 50 def proxy stack.last.proxy end |