Class: Postspec::FrameStack
- Inherits:
-
Object
- Object
- Postspec::FrameStack
- Defined in:
- lib/postspec/frame.rb
Instance Attribute Summary collapse
-
#postspec ⇒ Object
readonly
Returns the value of attribute postspec.
Instance Method Summary collapse
- #dump ⇒ Object
-
#initialize(postspec) ⇒ FrameStack
constructor
A new instance of FrameStack.
- #pop ⇒ Object
- #push(frame) ⇒ Object
- #top ⇒ Object
Constructor Details
#initialize(postspec) ⇒ FrameStack
Returns a new instance of FrameStack.
10 11 12 13 14 |
# File 'lib/postspec/frame.rb', line 10 def initialize(postspec) constrain postspec, Postspec @postspec = postspec @stack = [] end |
Instance Attribute Details
#postspec ⇒ Object (readonly)
Returns the value of attribute postspec.
7 8 9 |
# File 'lib/postspec/frame.rb', line 7 def postspec @postspec end |
Instance Method Details
#dump ⇒ Object
21 22 23 24 |
# File 'lib/postspec/frame.rb', line 21 def dump() puts self.class indent { @stack.reverse.map(&:dump) } end |
#pop ⇒ Object
19 |
# File 'lib/postspec/frame.rb', line 19 def pop() @stack.pop end |
#push(frame) ⇒ Object
18 |
# File 'lib/postspec/frame.rb', line 18 def push(frame) @stack.push frame; frame end |
#top ⇒ Object
20 |
# File 'lib/postspec/frame.rb', line 20 def top() @stack.last end |