class PageLinks
Constants
- SPLIT_LINK
- SPLIT_LINKS
Public Class Methods
new(link)
click to toggle source
# File lib/gitsheet/pagelinks.rb, line 7 def initialize(link) @links = {} link.split(PageLinks::SPLIT_LINKS).each do |link| section = link.split PageLinks::SPLIT_LINK raise 'Page Links could not be split on ;' if section.length < 2 page_number = section[0].slice(section[0].length - 2, 1) page_relation = section[1].gsub(/rel="(.*)"/, '\1').lstrip @links[page_relation] = page_number end end
Public Instance Methods
first()
click to toggle source
# File lib/gitsheet/pagelinks.rb, line 30 def first @links['first'].to_i end
last()
click to toggle source
# File lib/gitsheet/pagelinks.rb, line 34 def last @links['last'].to_i end
next()
click to toggle source
# File lib/gitsheet/pagelinks.rb, line 22 def next @links['next'].to_i end
next?()
click to toggle source
# File lib/gitsheet/pagelinks.rb, line 38 def next? !!@links['next'] end
none?()
click to toggle source
# File lib/gitsheet/pagelinks.rb, line 46 def none? @links.empty? end
prev()
click to toggle source
# File lib/gitsheet/pagelinks.rb, line 26 def prev @links['prev'].to_i end
prev?()
click to toggle source
# File lib/gitsheet/pagelinks.rb, line 42 def prev? !!@links['prev'] end