Class: Twat::TweetStack

Inherits:
Object
  • Object
show all
Defined in:
lib/twat/actions/follow.rb

Instance Method Summary collapse

Constructor Details

#initializeTweetStack

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

Returns:

  • (Boolean)


22
23
24
# File 'lib/twat/actions/follow.rb', line 22

def include? k
  @stack.keys.include?(k)
end

#lastObject



26
27
28
29
# File 'lib/twat/actions/follow.rb', line 26

def last
  # I see the irony
  @_next
end