Class: Jekyll::Plugins::PaginateV3::Pagination::GroupReference
- Inherits:
-
Liquid::Drop
- Object
- Liquid::Drop
- Jekyll::Plugins::PaginateV3::Pagination::GroupReference
- Defined in:
- lib/jekyll-paginate-v3/pagination/paginator/group_reference.rb
Overview
Liquid-facing grouped-set reference.
Similar to IndexReference, but start/end represent group range
bounds rather than 1-based item positions.
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#num ⇒ Object
readonly
Returns the value of attribute num.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
Instance Method Summary collapse
-
#initialize(num:, page_object:, item_count:, range_start:, range_end:) ⇒ GroupReference
constructor
Stores one grouped-set neighbour reference.
-
#liquid_method_missing(method_name) ⇒ Object
Handles
endbecause it is a Ruby keyword and cannot be a method name. -
#to_h ⇒ Object
Hash form used by specs and non-Liquid inspection.
Constructor Details
#initialize(num:, page_object:, item_count:, range_start:, range_end:) ⇒ GroupReference
Stores one grouped-set neighbour reference.
17 18 19 20 21 22 23 |
# File 'lib/jekyll-paginate-v3/pagination/paginator/group_reference.rb', line 17 def initialize(num:, page_object:, item_count:, range_start:, range_end:) @num = num.to_i @page = page_object @count = item_count.to_i @start = range_start @range_end = range_end end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
14 15 16 |
# File 'lib/jekyll-paginate-v3/pagination/paginator/group_reference.rb', line 14 def count @count end |
#num ⇒ Object (readonly)
Returns the value of attribute num.
14 15 16 |
# File 'lib/jekyll-paginate-v3/pagination/paginator/group_reference.rb', line 14 def num @num end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
14 15 16 |
# File 'lib/jekyll-paginate-v3/pagination/paginator/group_reference.rb', line 14 def page @page end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
14 15 16 |
# File 'lib/jekyll-paginate-v3/pagination/paginator/group_reference.rb', line 14 def start @start end |
Instance Method Details
#liquid_method_missing(method_name) ⇒ Object
Handles end because it is a Ruby keyword and cannot be a method name.
38 39 40 41 42 |
# File 'lib/jekyll-paginate-v3/pagination/paginator/group_reference.rb', line 38 def liquid_method_missing(method_name) return @range_end if method_name.to_s == 'end' super end |
#to_h ⇒ Object
Hash form used by specs and non-Liquid inspection.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/jekyll-paginate-v3/pagination/paginator/group_reference.rb', line 26 def to_h payload = { 'num' => num, 'page' => page, 'count' => count, 'start' => start } payload['end'] = @range_end unless @range_end.nil? payload end |