Class: SourceMonitor::Logs::Query::Result
- Inherits:
-
Struct
- Object
- Struct
- SourceMonitor::Logs::Query::Result
- Defined in:
- lib/source_monitor/logs/query.rb
Instance Attribute Summary collapse
-
#entries ⇒ Object
Returns the value of attribute entries.
-
#filter_set ⇒ Object
Returns the value of attribute filter_set.
-
#has_next_page ⇒ Object
Returns the value of attribute has_next_page.
-
#has_previous_page ⇒ Object
Returns the value of attribute has_previous_page.
-
#page ⇒ Object
Returns the value of attribute page.
-
#per_page ⇒ Object
Returns the value of attribute per_page.
-
#total_count ⇒ Object
Returns the value of attribute total_count.
Instance Method Summary collapse
- #has_next_page? ⇒ Boolean
- #has_previous_page? ⇒ Boolean
- #next_page ⇒ Object
- #previous_page ⇒ Object
- #total_pages ⇒ Object
Instance Attribute Details
#entries ⇒ Object
Returns the value of attribute entries
6 7 8 |
# File 'lib/source_monitor/logs/query.rb', line 6 def entries @entries end |
#filter_set ⇒ Object
Returns the value of attribute filter_set
6 7 8 |
# File 'lib/source_monitor/logs/query.rb', line 6 def filter_set @filter_set end |
#has_next_page ⇒ Object
Returns the value of attribute has_next_page
6 7 8 |
# File 'lib/source_monitor/logs/query.rb', line 6 def has_next_page @has_next_page end |
#has_previous_page ⇒ Object
Returns the value of attribute has_previous_page
6 7 8 |
# File 'lib/source_monitor/logs/query.rb', line 6 def has_previous_page @has_previous_page end |
#page ⇒ Object
Returns the value of attribute page
6 7 8 |
# File 'lib/source_monitor/logs/query.rb', line 6 def page @page end |
#per_page ⇒ Object
Returns the value of attribute per_page
6 7 8 |
# File 'lib/source_monitor/logs/query.rb', line 6 def per_page @per_page end |
#total_count ⇒ Object
Returns the value of attribute total_count
6 7 8 |
# File 'lib/source_monitor/logs/query.rb', line 6 def total_count @total_count end |
Instance Method Details
#has_next_page? ⇒ Boolean
16 17 18 |
# File 'lib/source_monitor/logs/query.rb', line 16 def has_next_page? !!self[:has_next_page] end |
#has_previous_page? ⇒ Boolean
20 21 22 |
# File 'lib/source_monitor/logs/query.rb', line 20 def has_previous_page? !!self[:has_previous_page] end |
#next_page ⇒ Object
24 25 26 27 28 |
# File 'lib/source_monitor/logs/query.rb', line 24 def next_page return nil unless has_next_page? page + 1 end |
#previous_page ⇒ Object
30 31 32 33 34 |
# File 'lib/source_monitor/logs/query.rb', line 30 def previous_page return nil unless has_previous_page? [ page - 1, 1 ].max end |
#total_pages ⇒ Object
36 37 38 39 40 |
# File 'lib/source_monitor/logs/query.rb', line 36 def total_pages return 1 if total_count.nil? || total_count <= 0 [ 1, (total_count.to_f / per_page).ceil ].max end |