dry-inflector 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c6a797f23150eb58f07e63794a61f5e2e904b6b51e7029678e2a6fd01e7413d2
4
- data.tar.gz: 338a9cf61f97e6afe9d298e70017575b89cea25dfeca4159dc97763f51efaecb
3
+ metadata.gz: c399013c00255e60a1adc6c44984238b5b331a9d8432489a189131ac0e7545b3
4
+ data.tar.gz: a59e33a3ca433c23bd0248413374b21da91a43d2ac666b1e30033f1e04d144de
5
5
  SHA512:
6
- metadata.gz: 50f87e79a468bd3001605e7aa9598d4f0b519e88f3fa0b0b9567e88dc2ca583f7dfe56e1dfe59caf8bc77e00cb6e5f73703e2d6fc5742dd7512bbb9fdd578d12
7
- data.tar.gz: b3de9ce00c62bbe31aaeef50bd54b2fe30f0a7a37e5850ac4e44a0c6b57333d6528828735289336a4cb658c685f7a9c81e2ef1b429b2a3455bad857330894130
6
+ metadata.gz: 9e6ef7a7de2938808c7f01344335d370793a6d0cfa64d0afa42a6481f60cf84bc66ae8080f32706908421d3c13bb5650ab8368fe881bd5c268a3eaafcd9f1da6
7
+ data.tar.gz: 30cf65fc5594d8352b1d43b113f98b37b0e01b88e20301c4d02e11116030fcc16acb174c730953876c7337ada68c57b882c3f061a36788511a2763041374585e
@@ -2,7 +2,11 @@
2
2
 
3
3
  Inflector for Ruby
4
4
 
5
- ## v0.1.0 (unreleased)
5
+ ## v0.1.1 - 2017-11-18
6
+ ### Fixed
7
+ - [Luca Guidi & Abinoam P. Marques Jr.] Ensure `Dry::Inflector#ordinalize` to work for all the numbers from 0 to 100
8
+
9
+ ## v0.1.0 - 2017-11-17
6
10
  ### Added
7
11
  - [Luca Guidi] Introduced `Dry::Inflector#pluralize`
8
12
  - [Luca Guidi] Introduced `Dry::Inflector#singularize`
@@ -14,3 +18,5 @@ Inflector for Ruby
14
18
  - [Luca Guidi] Introduced `Dry::Inflector#demodulize`
15
19
  - [Luca Guidi] Introduced `Dry::Inflector#humanize`
16
20
  - [Luca Guidi] Introduced `Dry::Inflector#ordinalize`
21
+ - [Abinoam P. Marques Jr.] Introduced `Dry::Inflector#foreign_key`
22
+ - [Abinoam P. Marques Jr.] Introduced `Dry::Inflector#constantize`
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [gitter]: https://gitter.im/dry-rb/chat
2
- [gem]: https://img.shields.io/gem/v/dry-inflector.svg]
2
+ [gem]: https://img.shields.io/gem/v/dry-inflector.svg
3
3
  [travis]: https://travis-ci.org/dry-rb/dry-inflector
4
4
  [gemnasium]: https://gemnasium.com/dry-rb/dry-inflector
5
5
  [codeclimate]: https://codeclimate.com/github/dry-rb/dry-inflector
@@ -25,8 +25,8 @@ Gem::Specification.new do |spec|
25
25
  spec.files = `git ls-files -- lib/* CHANGELOG.md LICENSE.md README.md dry-inflector.gemspec`.split($INPUT_RECORD_SEPARATOR)
26
26
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
27
27
 
28
- spec.add_development_dependency "bundler", "~> 1.15"
28
+ spec.add_development_dependency "bundler", "~> 1.16"
29
29
  spec.add_development_dependency "rake", "~> 12.0"
30
- spec.add_development_dependency "rspec", "~> 3.6"
30
+ spec.add_development_dependency "rspec", "~> 3.7"
31
31
  spec.add_development_dependency "rubocop", "~> 0.50.0"
32
32
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "set"
4
-
5
3
  module Dry
6
4
  # dry-inflector
7
5
  #
@@ -172,16 +170,17 @@ module Dry
172
170
  # inflector.ordinalize(3) # => "3rd"
173
171
  # inflector.ordinalize(10) # => "10th"
174
172
  # inflector.ordinalize(23) # => "23rd"
175
- def ordinalize(number)
173
+ def ordinalize(number) # rubocop:disable Metrics/MethodLength
176
174
  abs_value = number.abs
177
175
 
178
- if ORDINALIZE_TH.include?(abs_value % 100)
176
+ if ORDINALIZE_TH.key?(abs_value % 100)
179
177
  "#{number}th"
180
178
  else
181
179
  case abs_value % 10
182
180
  when 1 then "#{number}st"
183
181
  when 2 then "#{number}nd"
184
182
  when 3 then "#{number}rd"
183
+ else "#{number}th"
185
184
  end
186
185
  end
187
186
  end
@@ -273,7 +272,7 @@ module Dry
273
272
 
274
273
  # @since 0.1.0
275
274
  # @api private
276
- ORDINALIZE_TH = (4..16).to_set.freeze
275
+ ORDINALIZE_TH = (11..13).each_with_object({}) { |n, ret| ret[n] = true }.freeze
277
276
 
278
277
  # @since 0.1.0
279
278
  # @api private
@@ -3,6 +3,6 @@
3
3
  module Dry
4
4
  class Inflector
5
5
  # @since 0.1.0
6
- VERSION = "0.1.0"
6
+ VERSION = "0.1.1"
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-inflector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2017-11-17 00:00:00.000000000 Z
13
+ date: 2017-11-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: '1.15'
21
+ version: '1.16'
22
22
  type: :development
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - "~>"
27
27
  - !ruby/object:Gem::Version
28
- version: '1.15'
28
+ version: '1.16'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: rake
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -46,14 +46,14 @@ dependencies:
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '3.6'
49
+ version: '3.7'
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '3.6'
56
+ version: '3.7'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: rubocop
59
59
  requirement: !ruby/object:Gem::Requirement