class GithubApi::FollowersPage
Attributes
name[R]
page[R]
Public Class Methods
new(user_name, page_number)
click to toggle source
# File lib/unofficial-github-api/github_api.rb, line 44 def initialize(user_name, page_number) @name = user_name @page = page_number end
Public Instance Methods
content()
click to toggle source
# File lib/unofficial-github-api/github_api.rb, line 49 def content @content ||= Nokogiri::HTML(open("https://github.com/#{name}/followers?page=#{page}")) end
follower_exists?(i)
click to toggle source
# File lib/unofficial-github-api/github_api.rb, line 61 def follower_exists?(i) follower_row(i).to_ary != [] end
follower_name(i)
click to toggle source
# File lib/unofficial-github-api/github_api.rb, line 57 def follower_name(i) follower_row(i).children[1].attributes['href'].value.gsub(/\//,'') end
follower_row(i)
click to toggle source
# File lib/unofficial-github-api/github_api.rb, line 53 def follower_row(i) content.xpath("//*[@id='site-container']/div[2]/ol/li[#{i}]") end
followers_list()
click to toggle source
# File lib/unofficial-github-api/github_api.rb, line 65 def followers_list i, list = 1, [] while follower_exists?(i) list << follower_name(i) i += 1 end list end