Skip to content

Instantly share code, notes, and snippets.

View eduardoprentcomau's full-sized avatar

Eduardo Pacheco eduardoprentcomau

View GitHub Profile
@thesowah
thesowah / plh.rb
Last active July 30, 2021 18:02
Parse link headers from Github API in Ruby
require 'rest_client'
class Plh
def self.parse_link_header(url, params={})
response = RestClient.get url, params
links = Hash.new
parts = response.headers[:link].split(',')
# Parse each part into a named link
parts.each do |part, index|