pagy 0.11.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 844ca7b25affe1bb80fd78bc75aa6d91c55000134aecfea338288d57b9587231
4
- data.tar.gz: dc9e704d31c3fb376d23d560725c921484ef4ea037524a8bf86c67246069f62f
3
+ metadata.gz: fe753e045073fb8288a4d14f62484a4a940fb17ce18640655b33d9c353bec7ea
4
+ data.tar.gz: a0c3eab48bf5a0c0d47cd52448e7c11495e758ffbc6c033e6a68222eaf6d6a2b
5
5
  SHA512:
6
- metadata.gz: 7fe1bc2404142977f00b1285081a6fc39c9b1be5be6813efa8271cebb2b7e1e58349264458cfd5874afca86bb4d0c3e693b3dc1721d0ceccbdfb0d569a5f4dc2
7
- data.tar.gz: 2d066a55b2103ff8c96baadab07730413692f8233d4e28eeecbef1fe1fc04770b47b48aa92b3fa4212f6e82652ab72bed47822f3babbb77a8726868cbb6ab064
6
+ metadata.gz: af246da4e7af45b15c67813e39634ff672b0bcbe18e049803652759ab6bfc7fe66f83de8dcbce5573b7793b429b91ad9485175bb480dcf458d4f8c335e7e2635
7
+ data.tar.gz: ce00e10c5c72ab2520dba027113b4d1adff0045d5a29e93feca3e5870fd6482fba4eba0d8cc7924cd15c2919e4b7fdf10c6f46efb87ef10c206126ca7d08339a
@@ -1,25 +1,23 @@
1
- # This file adds support for multiple built-in plualiztion types.
2
- # It defines the pluralization procs and gets eval(ed) at I18N.load time
1
+ # This file adds support for multiple built-in plualization types.
2
+ # It defines the pluralization procs and gets eval(ed) at I18N.load time.
3
3
  # frozen_string_literal: true
4
4
 
5
5
  # utility variables
6
6
  zero_one = ['zero', 'one']
7
7
 
8
- # Rules
9
- # A rule is a proc returning a plural type string based on the passed count
10
- # Each plural rule may apply to many language/rule pairs below
11
- rules = {
8
+ # Plurals
9
+ # A plural proc returns a plural type string based on the passed count
10
+ # Each plural proc may apply to one or more languages below
11
+ plurals = {
12
12
  zero_one_other: -> (count) {zero_one[count] || 'other'}
13
13
  }
14
14
 
15
- # Plurals (language/rule pairs)
16
- # The default rule for missing languages is the :zero_one_other rule (used for English)
17
- plurals = Hash.new(rules[:zero_one_other])
15
+ # Languages (language/plural pairs)
16
+ # Contain all the entries for all the languages defined in the pagy.yml dictionary
17
+ # The default plural for missing languages is the :zero_one_other plural (used for English)
18
+ Hash.new(plurals[:zero_one_other]).tap do |languages|
19
+ languages['en'] = plurals[:zero_one_other]
18
20
 
19
- # Entries for all the languages defined in the pagy.yml dictionary
20
- plurals['en'] = rules[:zero_one_other]
21
+ # PR for other languages and plurals are very welcome. Thanks!
21
22
 
22
- # PR for other languages are very welcome. Thanks!
23
-
24
- # Return plurals
25
- plurals
23
+ end
@@ -3,7 +3,7 @@
3
3
 
4
4
  require 'pathname'
5
5
 
6
- class Pagy ; VERSION = '0.11.0'
6
+ class Pagy ; VERSION = '0.11.1'
7
7
 
8
8
  class OutOfRangeError < StandardError; attr_reader :pagy; def initialize(pagy) @pagy = pagy end; end
9
9
 
@@ -55,8 +55,8 @@
55
55
 
56
56
  # Pagy::Frontend::I18N Constant
57
57
  # See https://ddnexus.github.io/pagy/api/frontend#i18n
58
- # Pagy::Frontend::I18N[:plurals] = -> (c) {([:zero, :one][c] || :other).to_s # default
59
- # Pagy::Frontend::I18N.load_file('path/to/dictionary.yml') # load a custom file
58
+ # Pagy::Frontend::I18N.load(file:'path/to/dictionary.yml', language:'en') # load a custom file
59
+ # Pagy::Frontend::I18N[:plural] = -> (count) {(['zero', 'one'][count] || 'other') # default
60
60
 
61
61
 
62
62
  # Rails: extras assets path required by compact, items and responsive extras
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pagy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Domizio Demichelis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-27 00:00:00.000000000 Z
11
+ date: 2018-07-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'Agnostic pagination in plain ruby: it works with any framework, ORM
14
14
  and DB type, with all kinds of collections, even pre-paginated, scopes, Arrays,