Class: PgEventstore::Web::Paginator::BaseCollection

Inherits:
Object
  • Object
show all
Defined in:
lib/pg_eventstore/web/paginator/base_collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_name, starting_id:, per_page:, order:, options: {}) ⇒ BaseCollection

Returns a new instance of BaseCollection.

Parameters:

  • config_name (Symbol)
  • starting_id (String, Integer, nil)
  • per_page (Integer)
  • order (Symbol)

    :asc or :desc

  • options (Hash) (defaults to: {})

    additional options to filter the collection



28
29
30
31
32
33
34
# File 'lib/pg_eventstore/web/paginator/base_collection.rb', line 28

def initialize(config_name, starting_id:, per_page:, order:, options: {})
  @config_name = config_name
  @starting_id = starting_id
  @per_page = per_page
  @order = order
  @options = options
end

Instance Attribute Details

#config_nameObject

Returns the value of attribute config_name.



9
10
11
# File 'lib/pg_eventstore/web/paginator/base_collection.rb', line 9

def config_name
  @config_name
end

#optionsObject

Returns the value of attribute options.



21
22
23
# File 'lib/pg_eventstore/web/paginator/base_collection.rb', line 21

def options
  @options
end

#orderObject

Returns the value of attribute order.



18
19
20
# File 'lib/pg_eventstore/web/paginator/base_collection.rb', line 18

def order
  @order
end

#per_pageObject

Returns the value of attribute per_page.



15
16
17
# File 'lib/pg_eventstore/web/paginator/base_collection.rb', line 15

def per_page
  @per_page
end

#starting_idObject

Returns the value of attribute starting_id.



12
13
14
# File 'lib/pg_eventstore/web/paginator/base_collection.rb', line 12

def starting_id
  @starting_id
end

Instance Method Details

#collectionArray

Returns:

  • (Array)

Raises:

  • (NotImplementedError)


37
38
39
# File 'lib/pg_eventstore/web/paginator/base_collection.rb', line 37

def collection
  raise NotImplementedError
end

#countInteger

Returns:

  • (Integer)


42
43
44
# File 'lib/pg_eventstore/web/paginator/base_collection.rb', line 42

def count
  collection.size
end

#next_page_starting_idString, ...

Returns:

  • (String, Integer, nil)

Raises:

  • (NotImplementedError)


47
48
49
# File 'lib/pg_eventstore/web/paginator/base_collection.rb', line 47

def next_page_starting_id
  raise NotImplementedError
end

#prev_page_starting_idString, ...

Returns:

  • (String, Integer, nil)

Raises:

  • (NotImplementedError)


52
53
54
# File 'lib/pg_eventstore/web/paginator/base_collection.rb', line 52

def prev_page_starting_id
  raise NotImplementedError
end

#total_countInteger

Returns:

  • (Integer)

Raises:

  • (NotImplementedError)


57
58
59
# File 'lib/pg_eventstore/web/paginator/base_collection.rb', line 57

def total_count
  raise NotImplementedError
end