Skip to content

Commit

Permalink
Freeze class immutable constant variable at first
Browse files Browse the repository at this point in the history
  • Loading branch information
berniechiu committed May 18, 2018
1 parent 25b8c56 commit fb8975b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/pagy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ 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] }
VARS = { items:20, outset:0, size:[1,4,4,1] }.freeze
I18N_PLURALS = ['zero', 'one'].freeze

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


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

0 comments on commit fb8975b

Please sign in to comment.