Class: Jekyll::Plugins::PaginateV3::Pagination::GroupPayload

Inherits:
Liquid::Drop
  • Object
show all
Defined in:
lib/jekyll-paginate-v3/pagination/paginator/group_payload.rb

Overview

Liquid-facing grouped-set payload for generated grouped indexes.

Exposed in paginator.groups and by shortcut at paginator.group (deepest index level).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key:, current:, next_reference:, first_reference:, last_reference:, previous_reference: nil, prev_reference: nil) ⇒ GroupPayload

Stores one complete set of group neighbour references.

Use previous_reference going forward; prev_reference remains as a backwards-compatible alias.



20
21
22
23
24
25
26
27
# File 'lib/jekyll-paginate-v3/pagination/paginator/group_payload.rb', line 20

def initialize(key:, current:, next_reference:, first_reference:, last_reference:, previous_reference: nil, prev_reference: nil)
	@key = key.to_s
	@current = current
	@next = next_reference
	@previous = previous_reference.nil? ? prev_reference : previous_reference
	@first = first_reference
	@last = last_reference
end

Instance Attribute Details

#currentObject (readonly)

Returns the value of attribute current.



14
15
16
# File 'lib/jekyll-paginate-v3/pagination/paginator/group_payload.rb', line 14

def current
  @current
end

#firstObject (readonly)

Returns the value of attribute first.



14
15
16
# File 'lib/jekyll-paginate-v3/pagination/paginator/group_payload.rb', line 14

def first
  @first
end

#keyObject (readonly)

Returns the value of attribute key.



14
15
16
# File 'lib/jekyll-paginate-v3/pagination/paginator/group_payload.rb', line 14

def key
  @key
end

#lastObject (readonly)

Returns the value of attribute last.



14
15
16
# File 'lib/jekyll-paginate-v3/pagination/paginator/group_payload.rb', line 14

def last
  @last
end

#nextObject (readonly)

Returns the value of attribute next.



14
15
16
# File 'lib/jekyll-paginate-v3/pagination/paginator/group_payload.rb', line 14

def next
  @next
end

#previousObject (readonly)

Returns the value of attribute previous.



14
15
16
# File 'lib/jekyll-paginate-v3/pagination/paginator/group_payload.rb', line 14

def previous
  @previous
end

Instance Method Details

#prevObject

Backwards-compatible alias for previous grouped-set reference.



30
31
32
# File 'lib/jekyll-paginate-v3/pagination/paginator/group_payload.rb', line 30

def prev
	previous
end

#to_hObject

Hash form used by specs and non-Liquid inspection.



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/jekyll-paginate-v3/pagination/paginator/group_payload.rb', line 35

def to_h
	{
		'key' => key,
		'current' => current,
		'next' => self.next,
		'previous' => previous,
		'prev' => prev,
		'first' => first,
		'last' => last
	}
end