Module: NeverBounce::CLI::Script::Feature::UsesPagination

Defined in:
lib/never_bounce/cli/script/feature/uses_pagination.rb

Overview

Common traits for scripts which support pagination.

See Also:

Defined Under Namespace

Modules: InstanceMethods

Class Method Summary collapse

Class Method Details

.load(owner) ⇒ nil

Parameters:

  • owner (Class)

Returns:

  • (nil)

8
9
10
11
12
13
14
15
16
17
18
# File 'lib/never_bounce/cli/script/feature/uses_pagination.rb', line 8

def self.load(owner)
  return if owner < InstanceMethods
  owner.send(:include, InstanceMethods)

  owner.class_eval do
    attr_writer :page, :per_page

    envar "PAGE", "Fetch page number N", [{default: 1}, 5]
    envar "PER_PAGE", "Paginate results N items per page", [10, default: 1000]
  end
end