dry-inflector 1.0.0 → 1.2.0

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: 3a76b37b2022509e4cfedeec51993ceb9b86a6f1958cdd2e622c96c3e58bde25
4
- data.tar.gz: c84af6c67bd4719d933c7e6eb7844fe8730486368a6202a2999e0d526bc71837
3
+ metadata.gz: a29169ed905c202d9bb082e009642b814ad1b19e32c8915d94f16725e291e93f
4
+ data.tar.gz: 4ed346b04b6f0330eb5cec81dca8e8ba3e77a80ddfe6ce3c29662be0413a7119
5
5
  SHA512:
6
- metadata.gz: 1ed59c92bee7388db944360a6df90d0de35996fb197d74fbf7127ccf34adef3415c4dfc4ede88a43c433fdec8a4aee88a2d419682a608dcc45101411cbb7f3d9
7
- data.tar.gz: b0c27e24e5e5b23d4a075b33682079ea441121e9c5514f3e98fa7e875162873e1b3c3478ae0809e33d6e84ae7d0017c208355172ca4a84de0d06c657f45a0e70
6
+ metadata.gz: 1f224fb42751e9df20caf821987c1595af1c3952090aad3163fb4357cd67b9376e1791ba6837551cf7d35f30aa3398fc7c4e69f8df7a3d36f6c801b9cf65479c
7
+ data.tar.gz: 07b107dd66fee8bcb856139969223e35229997b934005a3e6a0b63d965326f90fc9f61e1585a0609e00b938987693dee009996358776328c107ce12b75f257ea
data/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
2
2
 
3
+ ## 1.2.0 2025-01-04
4
+
5
+
6
+ ### Changed
7
+
8
+ - Bumped required Ruby version to 3.1 (@flash-gordon)
9
+
10
+ [Compare v1.1.0...v1.2.0](https://github.com/dry-rb/dry-inflector/compare/v1.1.0...v1.2.0)
11
+
12
+ ## 1.1.0 2024-07-02
13
+
14
+
15
+ ### Added
16
+
17
+ - Added "DB" as a default acronym (#49) (@timriley)
18
+
19
+ ### Fixed
20
+
21
+ - Fix incorrect inflections on words separated by spaces, underscores or hyphens (#47) (@parndt)
22
+
23
+
24
+ [Compare v1.0.0...v1.1.0](https://github.com/dry-rb/dry-inflector/compare/v1.0.0...v1.1.0)
25
+
3
26
  ## 1.0.0 2022-11-04
4
27
 
5
28
 
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2021 dry-rb team
3
+ Copyright (c) 2015-2023 dry-rb team
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
data/README.md CHANGED
@@ -1,29 +1,21 @@
1
1
  <!--- this file is synced from dry-rb/template-gem project -->
2
2
  [gem]: https://rubygems.org/gems/dry-inflector
3
3
  [actions]: https://github.com/dry-rb/dry-inflector/actions
4
- [codacy]: https://www.codacy.com/gh/dry-rb/dry-inflector
5
- [chat]: https://dry-rb.zulipchat.com
6
- [inchpages]: http://inch-ci.org/github/dry-rb/dry-inflector
7
4
 
8
- # dry-inflector [![Join the chat at https://dry-rb.zulipchat.com](https://img.shields.io/badge/dry--rb-join%20chat-%23346b7a.svg)][chat]
9
-
10
- [![Gem Version](https://badge.fury.io/rb/dry-inflector.svg)][gem]
11
- [![CI Status](https://github.com/dry-rb/dry-inflector/workflows/ci/badge.svg)][actions]
12
- [![Codacy Badge](https://api.codacy.com/project/badge/Grade/00339f2fb77840149f999cac6110c8a8)][codacy]
13
- [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/00339f2fb77840149f999cac6110c8a8)][codacy]
14
- [![Inline docs](http://inch-ci.org/github/dry-rb/dry-inflector.svg?branch=main)][inchpages]
5
+ # dry-inflector [![Gem Version](https://badge.fury.io/rb/dry-inflector.svg)][gem] [![CI Status](https://github.com/dry-rb/dry-inflector/workflows/ci/badge.svg)][actions]
15
6
 
16
7
  ## Links
17
8
 
18
9
  * [User documentation](https://dry-rb.org/gems/dry-inflector)
19
10
  * [API documentation](http://rubydoc.info/gems/dry-inflector)
11
+ * [Forum](https://discourse.dry-rb.org)
20
12
 
21
13
  ## Supported Ruby versions
22
14
 
23
15
  This library officially supports the following Ruby versions:
24
16
 
25
- * MRI `>= 2.7.0`
26
- * jruby `>= 9.3` (postponed until 2.7 is supported)
17
+ * MRI `>= 3.0.0`
18
+ * jruby `>= 9.4` (not tested on CI)
27
19
 
28
20
  ## License
29
21
 
@@ -16,21 +16,17 @@ Gem::Specification.new do |spec|
16
16
  spec.summary = "String inflections for dry-rb"
17
17
  spec.description = spec.summary
18
18
  spec.homepage = "https://dry-rb.org/gems/dry-inflector"
19
- spec.files = Dir["CHANGELOG.md", "LICENSE", "README.md", "dry-inflector.gemspec", "lib/**/*"]
19
+ spec.files = Dir["CHANGELOG.md", "LICENSE", "README.md", "dry-inflector.gemspec",
20
+ "lib/**/*"]
20
21
  spec.bindir = "bin"
21
22
  spec.executables = []
22
23
  spec.require_paths = ["lib"]
23
24
 
24
- spec.metadata["allowed_push_host"] = "https://rubygems.org"
25
- spec.metadata["changelog_uri"] = "https://github.com/dry-rb/dry-inflector/blob/master/CHANGELOG.md"
26
- spec.metadata["source_code_uri"] = "https://github.com/dry-rb/dry-inflector"
27
- spec.metadata["bug_tracker_uri"] = "https://github.com/dry-rb/dry-inflector/issues"
25
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
26
+ spec.metadata["changelog_uri"] = "https://github.com/dry-rb/dry-inflector/blob/main/CHANGELOG.md"
27
+ spec.metadata["source_code_uri"] = "https://github.com/dry-rb/dry-inflector"
28
+ spec.metadata["bug_tracker_uri"] = "https://github.com/dry-rb/dry-inflector/issues"
29
+ spec.metadata["rubygems_mfa_required"] = "true"
28
30
 
29
- spec.required_ruby_version = ">= 2.7.0"
30
-
31
- # to update dependencies edit project.yml
32
-
33
- spec.add_development_dependency "bundler"
34
- spec.add_development_dependency "rake"
35
- spec.add_development_dependency "rspec"
31
+ spec.required_ruby_version = ">= 3.1"
36
32
  end
@@ -56,7 +56,7 @@ module Dry
56
56
  inflect.singular(/s\z/i, "")
57
57
  inflect.singular(/(n)ews\z/i, '\1ews')
58
58
  inflect.singular(/([ti])a\z/i, '\1um')
59
- inflect.singular(/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)\z/i,
59
+ inflect.singular(/(analy|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)\z/i,
60
60
  '\1\2sis')
61
61
  inflect.singular(/(^analy)(sis|ses)\z/i, '\1sis')
62
62
  inflect.singular(/([^f])ves\z/i, '\1fe')
@@ -75,7 +75,7 @@ module Dry
75
75
  inflect.singular(/(cris|ax|test)(is|es)\z/i, '\1is')
76
76
  inflect.singular(/(octop|vir)(us|i)\z/i, '\1us')
77
77
  inflect.singular(/(alias|status)(es)?\z/i, '\1')
78
- inflect.singular(/^(ox)en/i, '\1')
78
+ inflect.singular(/(ox)en/i, '\1')
79
79
  inflect.singular(/(vert|ind)ices\z/i, '\1ex')
80
80
  inflect.singular(/(matr)ices\z/i, '\1ix')
81
81
  inflect.singular(/(quiz)zes\z/i, '\1')
@@ -110,7 +110,16 @@ module Dry
110
110
  # @since 0.1.2
111
111
  # @api private
112
112
  def self.acronyms(inflect)
113
- inflect.acronym(*%w[JSON HTTP OpenSSL HMAC CSRF API CSV])
113
+ inflect.acronym(*%w[
114
+ API
115
+ CSRF
116
+ CSV
117
+ DB
118
+ HMAC
119
+ HTTP
120
+ JSON
121
+ OpenSSL
122
+ ])
114
123
  end
115
124
 
116
125
  private_class_method :plural, :singular, :irregular, :uncountable, :acronyms
@@ -29,8 +29,8 @@ module Dry
29
29
 
30
30
  # @since 0.1.0
31
31
  # @api private
32
- def each(&blk)
33
- @rules.each(&blk)
32
+ def each(&)
33
+ @rules.each(&)
34
34
  end
35
35
  end
36
36
  end
@@ -3,6 +3,6 @@
3
3
  module Dry
4
4
  class Inflector
5
5
  # @since 0.1.0
6
- VERSION = "1.0.0"
6
+ VERSION = "1.2.0"
7
7
  end
8
8
  end
data/lib/dry/inflector.rb CHANGED
@@ -30,8 +30,8 @@ module Dry
30
30
  # inflections.singular "thieves", "thief" # specify a rule for #singularize
31
31
  # inflections.uncountable "dry-inflector" # add an exception for an uncountable word
32
32
  # end
33
- def initialize(&blk)
34
- @inflections = Inflections.build(&blk)
33
+ def initialize(&)
34
+ @inflections = Inflections.build(&)
35
35
  end
36
36
 
37
37
  # Lower camelize a string
@@ -298,7 +298,9 @@ module Dry
298
298
  # @since 0.1.0
299
299
  # @api private
300
300
  def uncountable?(input)
301
- input.match?(/\A[[:space:]]*\z/) || inflections.uncountables.include?(input.downcase)
301
+ input.match?(/\A[[:space:]]*\z/) ||
302
+ inflections.uncountables.include?(input.downcase) ||
303
+ inflections.uncountables.include?(input.split(/_|\b/).last.downcase)
302
304
  end
303
305
 
304
306
  # @return [String]
metadata CHANGED
@@ -1,59 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-inflector
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
8
  - Andrii Savchenko
9
9
  - Abinoam P. Marques Jr.
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-11-04 00:00:00.000000000 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: bundler
17
- requirement: !ruby/object:Gem::Requirement
18
- requirements:
19
- - - ">="
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :development
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- version: '0'
29
- - !ruby/object:Gem::Dependency
30
- name: rake
31
- requirement: !ruby/object:Gem::Requirement
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
35
- version: '0'
36
- type: :development
37
- prerelease: false
38
- version_requirements: !ruby/object:Gem::Requirement
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: '0'
43
- - !ruby/object:Gem::Dependency
44
- name: rspec
45
- requirement: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: '0'
50
- type: :development
51
- prerelease: false
52
- version_requirements: !ruby/object:Gem::Requirement
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- version: '0'
13
+ date: 2025-01-04 00:00:00.000000000 Z
14
+ dependencies: []
57
15
  description: String inflections for dry-rb
58
16
  email:
59
17
  - me@lucaguidi.com
@@ -79,10 +37,11 @@ licenses:
79
37
  - MIT
80
38
  metadata:
81
39
  allowed_push_host: https://rubygems.org
82
- changelog_uri: https://github.com/dry-rb/dry-inflector/blob/master/CHANGELOG.md
40
+ changelog_uri: https://github.com/dry-rb/dry-inflector/blob/main/CHANGELOG.md
83
41
  source_code_uri: https://github.com/dry-rb/dry-inflector
84
42
  bug_tracker_uri: https://github.com/dry-rb/dry-inflector/issues
85
- post_install_message:
43
+ rubygems_mfa_required: 'true'
44
+ post_install_message:
86
45
  rdoc_options: []
87
46
  require_paths:
88
47
  - lib
@@ -90,15 +49,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
49
  requirements:
91
50
  - - ">="
92
51
  - !ruby/object:Gem::Version
93
- version: 2.7.0
52
+ version: '3.1'
94
53
  required_rubygems_version: !ruby/object:Gem::Requirement
95
54
  requirements:
96
55
  - - ">="
97
56
  - !ruby/object:Gem::Version
98
57
  version: '0'
99
58
  requirements: []
100
- rubygems_version: 3.1.6
101
- signing_key:
59
+ rubygems_version: 3.3.27
60
+ signing_key:
102
61
  specification_version: 4
103
62
  summary: String inflections for dry-rb
104
63
  test_files: []