Class: Twat::TweetStack
- Inherits:
-
Object
- Object
- Twat::TweetStack
- Defined in:
- lib/twat/actions/follow.rb
Instance Method Summary collapse
- #<<(v) ⇒ Object
- #[](k) ⇒ Object
- #include?(k) ⇒ Boolean
-
#initialize ⇒ TweetStack
constructor
A circularly linked list representing all of the tweets printed thus far, for the purposes of retrieving them after being printed.
- #last ⇒ Object
Constructor Details
#initialize ⇒ TweetStack
A circularly linked list representing all of the tweets printed thus far, for the purposes of retrieving them after being printed
9 10 11 12 |
# File 'lib/twat/actions/follow.rb', line 9 def initialize @stack = {} @_next = 0 end |
Instance Method Details
#<<(v) ⇒ Object
18 19 20 |
# File 'lib/twat/actions/follow.rb', line 18 def << v @stack[nxt] = v end |
#[](k) ⇒ Object
14 15 16 |
# File 'lib/twat/actions/follow.rb', line 14 def [] k @stack[k] end |
#include?(k) ⇒ Boolean
22 23 24 |
# File 'lib/twat/actions/follow.rb', line 22 def include? k @stack.keys.include?(k) end |
#last ⇒ Object
26 27 28 29 |
# File 'lib/twat/actions/follow.rb', line 26 def last # I see the irony @_next end |