Class: LedgerSync::Domains::Operation::Search::PaginatedResult

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/ledger_sync/domains/operation/search.rb

Overview

make kaminari work with serialized results

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#current_pageObject

Returns the value of attribute current_page.



12
13
14
# File 'lib/ledger_sync/domains/operation/search.rb', line 12

def current_page
  @current_page
end

#last_pageObject

Returns the value of attribute last_page.



12
13
14
# File 'lib/ledger_sync/domains/operation/search.rb', line 12

def last_page
  @last_page
end

#limit_valueObject

Returns the value of attribute limit_value.



12
13
14
# File 'lib/ledger_sync/domains/operation/search.rb', line 12

def limit_value
  @limit_value
end

#next_pageObject

Returns the value of attribute next_page.



12
13
14
# File 'lib/ledger_sync/domains/operation/search.rb', line 12

def next_page
  @next_page
end

#total_countObject

Returns the value of attribute total_count.



12
13
14
# File 'lib/ledger_sync/domains/operation/search.rb', line 12

def total_count
  @total_count
end

#total_pagesObject

Returns the value of attribute total_pages.



12
13
14
# File 'lib/ledger_sync/domains/operation/search.rb', line 12

def total_pages
  @total_pages
end

Class Method Details

.from_result(result, items:) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/ledger_sync/domains/operation/search.rb', line 15

def self.from_result(result, items:)
  search = new(items)
  search.next_page = result.next_page
  search.last_page = result.last_page?
  search.current_page = result.current_page
  search.total_pages = result.total_pages
  search.total_count = result.total_count
  search.limit_value = result.limit_value
  search
end

Instance Method Details

#last_page?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/ledger_sync/domains/operation/search.rb', line 26

def last_page?
  last_page == true
end