liquid_pluralize 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/liquid_pluralize.rb +16 -0
  3. metadata +58 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f1ea35869f5e50e852ffb412d37a9a4f741690bb
4
+ data.tar.gz: 4177e8a83d7742a70d84904d3b53b98b15ac5555
5
+ SHA512:
6
+ metadata.gz: 59ef870d3d69a022f26dedb816cb1ea1698cdc9b75888a3c71ed7a5a672414f8e0a38bf845242341bc80d06fc12652b85e9200a335e197beb4e680957bdb5b99
7
+ data.tar.gz: 3a9b1c8305f99e5da05270c34bb26c061d0596a1f3a3c4349bb833edd5a4f077dbc8e14fdc6d2b808011361f31720143ce58d2549472c6a7cc2fad010b93b682
@@ -0,0 +1,16 @@
1
+ module Pluralize
2
+
3
+ def pluralize(number, singular, plural = nil)
4
+ number = number.to_i
5
+ if number == 1
6
+ "#{number} #{singular}"
7
+ elsif plural.nil?
8
+ "#{number} #{singular}s"
9
+ else
10
+ "#{number} #{plural}"
11
+ end
12
+ end
13
+
14
+ end
15
+
16
+ Liquid::Template.register_filter(Pluralize)
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: liquid_pluralize
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Benjamin Esham
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: liquid
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.6'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.6'
27
+ description: Pluralize is a Liquid filter to make it easy to form correct plurals.
28
+ email: benjamin@esham.io
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - lib/liquid_pluralize.rb
34
+ homepage: https://github.com/bdesham/pluralize
35
+ licenses:
36
+ - Public domain
37
+ metadata: {}
38
+ post_install_message:
39
+ rdoc_options: []
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ requirements: []
53
+ rubyforge_project:
54
+ rubygems_version: 2.4.2
55
+ signing_key:
56
+ specification_version: 4
57
+ summary: A Liquid filter to make it easy to form correct plurals.
58
+ test_files: []