Class: Rack::Metrics::Stack
- Inherits:
-
Object
- Object
- Rack::Metrics::Stack
- Defined in:
- lib/rack/metrics.rb
Instance Method Summary collapse
- #empty? ⇒ Boolean
- #first ⇒ Object
-
#initialize ⇒ Stack
constructor
A new instance of Stack.
- #peek ⇒ Object
- #pop ⇒ Object
- #push(e) ⇒ Object (also: #<<)
Constructor Details
#initialize ⇒ Stack
Returns a new instance of Stack.
151 152 153 |
# File 'lib/rack/metrics.rb', line 151 def initialize @storage = [] end |
Instance Method Details
#empty? ⇒ Boolean
172 173 174 |
# File 'lib/rack/metrics.rb', line 172 def empty? @storage.empty? end |
#first ⇒ Object
168 169 170 |
# File 'lib/rack/metrics.rb', line 168 def first @storage.first end |
#peek ⇒ Object
164 165 166 |
# File 'lib/rack/metrics.rb', line 164 def peek @storage.last end |
#pop ⇒ Object
160 161 162 |
# File 'lib/rack/metrics.rb', line 160 def pop @storage.pop end |
#push(e) ⇒ Object Also known as: <<
155 156 157 |
# File 'lib/rack/metrics.rb', line 155 def push(e) @storage.push e end |