We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It would be nice if I could fetch the total number of contributors in a time window.
Currently, I'm parsing using Nokogiri, but I guess that's fine.
Sample code fwiw:
class Contributors attr_accessor :body, :start_date, :end_date, :total def initialize(start_date, end_date) @start_date = start_date.strftime("%Y%m%d") @end_date = end_date.strftime("%Y%m%d") @body = fetch @total = extract_total end def url "https://contributors.rubyonrails.org/contributors/in-time-window/#{@start_date}-#{@end_date}" end def fetch uri = URI.parse(url) body = uri.open.read return Nokogiri::HTML(body) end def extract_total xpath = "//span[@class=\"listing-total\"][1]" text = @body.xpath(xpath.to_s).first.content return text.match(/\d+/) end end
The text was updated successfully, but these errors were encountered:
No branches or pull requests
It would be nice if I could fetch the total number of contributors in a time window.
Currently, I'm parsing using Nokogiri, but I guess that's fine.
Sample code fwiw:
The text was updated successfully, but these errors were encountered: