Class: Twat::TweetStack
- Inherits:
-
Object
- Object
- Twat::TweetStack
- Defined in:
- lib/twat/tweetstack.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
5 6 7 8 |
# File 'lib/twat/tweetstack.rb', line 5 def initialize @stack = {} @_next = 0 end |
Instance Method Details
#<<(v) ⇒ Object
14 15 16 |
# File 'lib/twat/tweetstack.rb', line 14 def << v @stack[nxt] = v end |
#[](k) ⇒ Object
10 11 12 |
# File 'lib/twat/tweetstack.rb', line 10 def [] k @stack[k] end |
#include?(k) ⇒ Boolean
18 19 20 |
# File 'lib/twat/tweetstack.rb', line 18 def include? k @stack.keys.include?(k) end |
#last ⇒ Object
22 23 24 25 |
# File 'lib/twat/tweetstack.rb', line 22 def last # I see the irony @_next end |