Class: EPlat::Paginated::LinkHeaders

Inherits:
Object
  • Object
show all
Defined in:
lib/e_plat/resource/paginated/link_headers.rb

Defined Under Namespace

Classes: LinkHeader

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(link_header) ⇒ LinkHeaders

Returns a new instance of LinkHeaders.



11
12
13
14
15
16
# File 'lib/e_plat/resource/paginated/link_headers.rb', line 11

def initialize(link_header)
	links = parse_link_header(link_header)

	@previous_link = links.find { |link| link.rel == :previous }
	@next_link 	   = links.find { |link| link.rel == :next }
end

Instance Attribute Details

Returns the value of attribute next_link.



9
10
11
# File 'lib/e_plat/resource/paginated/link_headers.rb', line 9

def next_link
  @next_link
end

Returns the value of attribute previous_link.



9
10
11
# File 'lib/e_plat/resource/paginated/link_headers.rb', line 9

def previous_link
  @previous_link
end