Class: JSOM::Pagination::Links
- Inherits:
-
Object
- Object
- JSOM::Pagination::Links
- Defined in:
- lib/jsom/pagination/links.rb
Constant Summary collapse
- DEFAULT_PAGE_SIZE =
20
Instance Attribute Summary collapse
-
#next ⇒ Object
readonly
Returns the value of attribute next.
-
#prev ⇒ Object
readonly
Returns the value of attribute prev.
-
#self ⇒ Object
readonly
Returns the value of attribute self.
Instance Method Summary collapse
Instance Attribute Details
#next ⇒ Object (readonly)
Returns the value of attribute next.
28 29 30 |
# File 'lib/jsom/pagination/links.rb', line 28 def next @next end |
#prev ⇒ Object (readonly)
Returns the value of attribute prev.
28 29 30 |
# File 'lib/jsom/pagination/links.rb', line 28 def prev @prev end |
#self ⇒ Object (readonly)
Returns the value of attribute self.
28 29 30 |
# File 'lib/jsom/pagination/links.rb', line 28 def self @self end |
Instance Method Details
#first ⇒ Object
20 21 22 |
# File 'lib/jsom/pagination/links.rb', line 20 def first @first || generate_url(1) end |
#last ⇒ Object
24 25 26 |
# File 'lib/jsom/pagination/links.rb', line 24 def last @last || generate_url(total_pages) end |
#to_h ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/jsom/pagination/links.rb', line 10 def to_h { first: @first, prev: @prev, self: @self, next: @next, last: @last }.reject { |_key, value| value.nil? } end |