Skip to content

Commit

Permalink
changes for PR #2:
Browse files Browse the repository at this point in the history
- use of local variable zero_one instead of constant I18N_PLURALS
- VARS cannot be frozen
  • Loading branch information
ddnexus committed May 18, 2018
1 parent 64ddfd6 commit 6ea7a48
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/pagy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ class OutOfRangeError < StandardError; end
def self.root; Pathname.new(__FILE__).dirname end

# default core vars
VARS = { items:20, outset:0, size:[1,4,4,1] }.freeze
I18N_PLURALS = ['zero', 'one'].freeze
VARS = { items:20, outset:0, size:[1,4,4,1] }

# default I18n vars
I18N = { file: Pagy.root.join('locales', 'pagy.yml').to_s, plurals: -> (c) {I18N_PLURALS[c] || 'other'} }
zero_one = %w[zero one].freeze ; I18N = { file: Pagy.root.join('locales', 'pagy.yml').to_s, plurals: -> (c) {zero_one[c] || 'other'} }


attr_reader :count, :page, :items, :vars, :pages, :last, :offset, :from, :to, :prev, :next
Expand Down

0 comments on commit 6ea7a48

Please sign in to comment.