Class: God::Timeline
- Inherits:
-
Array
- Object
- Array
- God::Timeline
- Defined in:
- lib/god/timeline.rb
Instance Method Summary collapse
-
#initialize(max_size) ⇒ Timeline
constructor
Instantiate a new Timeline
max_size
is the maximum size to which the timeline should grow. -
#push(val) ⇒ Object
(also: #<<)
Push a value onto the Timeline
val
is the value to push.
Constructor Details
#initialize(max_size) ⇒ Timeline
Instantiate a new Timeline
+max_size+ is the maximum size to which the timeline should grow
Returns Timeline
8 9 10 11 |
# File 'lib/god/timeline.rb', line 8 def initialize(max_size) super() @max_size = max_size end |
Instance Method Details
#push(val) ⇒ Object Also known as: <<
Push a value onto the Timeline
+val+ is the value to push
Returns Timeline
17 18 19 20 |
# File 'lib/god/timeline.rb', line 17 def push(val) self.concat([val]) shift if size > @max_size end |