jamie (owner)

Fork Of

Revisions

gist: 4420 Download_button fork
public
Description:
refactor iteration to use map
Public Clone URL: git://gist.github.com/4420.git
Embed All Files: show embed
current.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
def following_pages
  twitter_user.friends_count.to_i / 100 + 1
end
 
def following
  @following ||= (1..following_pages).map do |i|
    twitter.friends_for(uid, :page => i, :lite => true)
  end.flatten
end
 
def followers_pages
  twitter_user.followers_count.to_i / 100 + 1
end
 
def followers
  @followers ||= (1..followers_pages).map do |i|
    twitter.followers_for(uid, :page => i, :lite => true)
  end.flatten
end