more_core_extensions 4.5.1 → 4.6.0
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 +4 -4
- data/.github/workflows/ci.yaml +21 -30
- data/CHANGELOG.md +14 -1
- data/Gemfile +5 -3
- data/README.md +3 -1
- data/lib/more_core_extensions/core_ext/array/compact_map.rb +1 -1
- data/lib/more_core_extensions/core_ext/array/deletes.rb +1 -1
- data/lib/more_core_extensions/core_ext/array/duplicates.rb +1 -1
- data/lib/more_core_extensions/core_ext/array/element_counts.rb +1 -1
- data/lib/more_core_extensions/core_ext/array/inclusions.rb +1 -1
- data/lib/more_core_extensions/core_ext/array/math.rb +1 -1
- data/lib/more_core_extensions/core_ext/array/nested.rb +1 -1
- data/lib/more_core_extensions/core_ext/array/random.rb +1 -1
- data/lib/more_core_extensions/core_ext/array/sorting.rb +1 -1
- data/lib/more_core_extensions/core_ext/array/stretch.rb +2 -2
- data/lib/more_core_extensions/core_ext/array/tableize.rb +1 -1
- data/lib/more_core_extensions/core_ext/benchmark/realtime_store.rb +1 -1
- data/lib/more_core_extensions/core_ext/class/hierarchy.rb +1 -1
- data/lib/more_core_extensions/core_ext/hash/deletes.rb +1 -1
- data/lib/more_core_extensions/core_ext/hash/nested.rb +1 -1
- data/lib/more_core_extensions/core_ext/hash/sorting.rb +2 -2
- data/lib/more_core_extensions/core_ext/math/slope.rb +1 -1
- data/lib/more_core_extensions/core_ext/module/cache_with_timeout.rb +2 -2
- data/lib/more_core_extensions/core_ext/module/namespace.rb +1 -1
- data/lib/more_core_extensions/core_ext/numeric/clamp.rb +1 -1
- data/lib/more_core_extensions/core_ext/numeric/math.rb +1 -1
- data/lib/more_core_extensions/core_ext/numeric/rounding.rb +1 -1
- data/lib/more_core_extensions/core_ext/object/deep_send.rb +1 -1
- data/lib/more_core_extensions/core_ext/object/namespace.rb +1 -1
- data/lib/more_core_extensions/core_ext/process/pause_resume.rb +1 -1
- data/lib/more_core_extensions/core_ext/range/step_value.rb +1 -1
- data/lib/more_core_extensions/core_ext/string/constantize_allowlist.rb +28 -0
- data/lib/more_core_extensions/core_ext/string/decimal_suffix.rb +1 -1
- data/lib/more_core_extensions/core_ext/string/formats.rb +2 -2
- data/lib/more_core_extensions/core_ext/string/hex_dump.rb +1 -1
- data/lib/more_core_extensions/core_ext/string/iec60027_2.rb +1 -1
- data/lib/more_core_extensions/core_ext/string/to_i_with_method.rb +4 -4
- data/lib/more_core_extensions/core_ext/string.rb +1 -0
- data/lib/more_core_extensions/core_ext/symbol/to_i.rb +1 -1
- data/lib/more_core_extensions/version.rb +1 -1
- data/more_core_extensions.gemspec +1 -0
- metadata +18 -5
- data/.codeclimate.yml +0 -16
- data/.rubocop_cc.yml +0 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: db27585d3a2280351c81edd511e431a1fc005edc5615c5a341d5f384e867cfd8
|
|
4
|
+
data.tar.gz: 74c600b678cf5d91a99bb871ea19528ebfdc478d810e194317c342ec1a3c94ce
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ce0c07aa4200c2cec7ce9e3a8972cd2bed8451567b967709a0e189af1debbc91c2b719765e398e479c08ebcb1b4af1de5fe93099005c2b817470abc07c6b6348
|
|
7
|
+
data.tar.gz: 28c842cb5c3cfff78d70c586ea18ca0f1dffb55f815b8d2c6acf5c91d825d6e058f735ec27888b605a3a8eda7c92bbfc37b7b454ab31cbb1b59e316851634218
|
data/.github/workflows/ci.yaml
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
---
|
|
2
1
|
name: CI
|
|
3
2
|
on:
|
|
4
|
-
push:
|
|
5
3
|
pull_request:
|
|
4
|
+
push:
|
|
5
|
+
branches-ignore:
|
|
6
|
+
- dependabot/*
|
|
7
|
+
- renovate/*
|
|
6
8
|
schedule:
|
|
7
9
|
- cron: 0 0 * * 0
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
concurrency:
|
|
12
|
+
group: "${{ github.workflow }}-${{ github.ref }}"
|
|
13
|
+
cancel-in-progress: true
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
8
16
|
jobs:
|
|
9
17
|
ci:
|
|
10
18
|
runs-on: ubuntu-latest
|
|
@@ -12,38 +20,25 @@ jobs:
|
|
|
12
20
|
fail-fast: false
|
|
13
21
|
matrix:
|
|
14
22
|
ruby-version:
|
|
15
|
-
- '2.7'
|
|
16
|
-
- '3.0'
|
|
17
23
|
- '3.1'
|
|
18
24
|
- '3.2'
|
|
19
25
|
- '3.3'
|
|
26
|
+
- '3.4'
|
|
27
|
+
- '4.0'
|
|
28
|
+
- ruby-head
|
|
20
29
|
rails-version:
|
|
21
|
-
- '
|
|
22
|
-
- '
|
|
23
|
-
- '
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
- ruby-version: '2.5'
|
|
28
|
-
rails-version: '6.0'
|
|
29
|
-
- ruby-version: '2.5'
|
|
30
|
-
rails-version: '6.1'
|
|
31
|
-
- ruby-version: '2.6'
|
|
32
|
-
rails-version: '6.0'
|
|
33
|
-
- ruby-version: '2.6'
|
|
34
|
-
rails-version: '6.1'
|
|
35
|
-
# Rails 7.2 supports Ruby >= 3.1.0
|
|
30
|
+
- '7.2'
|
|
31
|
+
- '8.0'
|
|
32
|
+
- '8.1'
|
|
33
|
+
exclude:
|
|
34
|
+
- ruby-version: '3.1'
|
|
35
|
+
rails-version: '8.1'
|
|
36
36
|
- ruby-version: '3.1'
|
|
37
|
-
rails-version: '
|
|
38
|
-
- ruby-version: '3.2'
|
|
39
|
-
rails-version: '7.2'
|
|
40
|
-
- ruby-version: '3.3'
|
|
41
|
-
rails-version: '7.2'
|
|
37
|
+
rails-version: '8.0'
|
|
42
38
|
env:
|
|
43
39
|
TEST_RAILS_VERSION: "${{ matrix.rails-version }}"
|
|
44
|
-
CC_TEST_REPORTER_ID: "${{ secrets.CC_TEST_REPORTER_ID }}"
|
|
45
40
|
steps:
|
|
46
|
-
- uses: actions/checkout@
|
|
41
|
+
- uses: actions/checkout@v6
|
|
47
42
|
- name: Set up Ruby
|
|
48
43
|
uses: ruby/setup-ruby@v1
|
|
49
44
|
with:
|
|
@@ -52,7 +47,3 @@ jobs:
|
|
|
52
47
|
timeout-minutes: 30
|
|
53
48
|
- name: Run tests
|
|
54
49
|
run: bundle exec rake
|
|
55
|
-
- name: Report code coverage
|
|
56
|
-
if: ${{ github.ref == 'refs/heads/master' && matrix.ruby-version == '3.1' }}
|
|
57
|
-
continue-on-error: true
|
|
58
|
-
uses: paambaati/codeclimate-action@v9
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [4.6.0] - 2026-04-28
|
|
8
|
+
### Added
|
|
9
|
+
- Add allowlist support to String#constantize and String#safe_constantize [[#155](https://github.com/ManageIQ/more_core_extensions/pull/155)]
|
|
10
|
+
- Add Ruby 3.4+, Rails 7.2+ support [[#134](https://github.com/ManageIQ/more_core_extensions/pull/134)]
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Fix literal `.` handling in the email regex [[#141](https://github.com/ManageIQ/more_core_extensions/pull/141)]
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- Drop Ruby < 3.1 and Rails < 7.2 support [[#134](https://github.com/ManageIQ/more_core_extensions/pull/134)]
|
|
17
|
+
- Add benchmark as a dependency for Rails 8.1+ [[#134](https://github.com/ManageIQ/more_core_extensions/pull/134)]
|
|
18
|
+
|
|
7
19
|
## [4.5.1] - 2025-01-31
|
|
8
20
|
### Fixed
|
|
9
21
|
- Fix issues where active_support does not require logger properly [[#127](https://github.com/ManageIQ/more_core_extensions/pull/127)]
|
|
@@ -122,7 +134,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
122
134
|
- Upgraded to RSpec 3 [[#16](https://github.com/ManageIQ/more_core_extensions/pull/16)]
|
|
123
135
|
- Added the Change Log!
|
|
124
136
|
|
|
125
|
-
[Unreleased]: https://github.com/ManageIQ/more_core_extensions/compare/v4.
|
|
137
|
+
[Unreleased]: https://github.com/ManageIQ/more_core_extensions/compare/v4.6.0...HEAD
|
|
138
|
+
[4.6.0]: https://github.com/ManageIQ/more_core_extensions/compare/v4.5.1...v4.6.0
|
|
126
139
|
[4.5.1]: https://github.com/ManageIQ/more_core_extensions/compare/v4.5.0...v4.5.1
|
|
127
140
|
[4.5.0]: https://github.com/ManageIQ/more_core_extensions/compare/v4.3.1...v4.5.0
|
|
128
141
|
[4.4.0]: https://github.com/ManageIQ/more_core_extensions/compare/v4.3.1...v4.4.0
|
data/Gemfile
CHANGED
|
@@ -7,7 +7,11 @@ require File.join(Bundler::Plugin.index.load_paths("bundler-inject")[0], "bundle
|
|
|
7
7
|
gemspec
|
|
8
8
|
|
|
9
9
|
minimum_version =
|
|
10
|
-
case ENV.fetch("TEST_RAILS_VERSION", "
|
|
10
|
+
case ENV.fetch("TEST_RAILS_VERSION", "8.0")
|
|
11
|
+
when "8.1"
|
|
12
|
+
"~>8.1.2"
|
|
13
|
+
when "8.0"
|
|
14
|
+
"~>8.0.4"
|
|
11
15
|
when "7.2"
|
|
12
16
|
"~>7.2.2"
|
|
13
17
|
when "7.1"
|
|
@@ -16,8 +20,6 @@ minimum_version =
|
|
|
16
20
|
"~>7.0.8"
|
|
17
21
|
when "6.1"
|
|
18
22
|
"~>6.1.7"
|
|
19
|
-
when "6.0"
|
|
20
|
-
"~>6.0.6"
|
|
21
23
|
else
|
|
22
24
|
raise "Unexpected Rails version #{ENV['TEST_RAILS_VERSION'].inspect}"
|
|
23
25
|
end
|
data/README.md
CHANGED
|
@@ -4,7 +4,6 @@ MoreCoreExtensions are a set of core extensions beyond those provided by ActiveS
|
|
|
4
4
|
|
|
5
5
|
[](http://badge.fury.io/rb/more_core_extensions)
|
|
6
6
|
[](https://github.com/ManageIQ/more_core_extensions/actions/workflows/ci.yaml)
|
|
7
|
-
[](https://codeclimate.com/github/ManageIQ/more_core_extensions)
|
|
8
7
|
[](https://coveralls.io/r/ManageIQ/more_core_extensions)
|
|
9
8
|
|
|
10
9
|
[](https://gitter.im/ManageIQ/more_core_extensions?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
@@ -107,6 +106,9 @@ MoreCoreExtensions are a set of core extensions beyond those provided by ActiveS
|
|
|
107
106
|
|
|
108
107
|
#### String
|
|
109
108
|
|
|
109
|
+
* core_ext/string/constantize_allowlist.rb
|
|
110
|
+
* `#constantize` - Enhanced version with optional `allowlist` parameter to restrict which constants can be resolved
|
|
111
|
+
* `#safe_constantize` - Enhanced version with optional `allowlist` parameter to restrict which constants can be resolved
|
|
110
112
|
* core_ext/string/decimal_suffix.rb
|
|
111
113
|
* `#decimal_si_to_big_decimal` - Returns a BigDecimal based on the number and suffix given
|
|
112
114
|
* `#decimal_si_to_f` - Returns a Float based on the number and suffix given
|
|
@@ -47,5 +47,5 @@ module MoreCoreExtensions
|
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
-
Array.
|
|
51
|
-
Array.
|
|
50
|
+
Array.extend MoreCoreExtensions::ArrayStretch::ClassMethods
|
|
51
|
+
Array.include MoreCoreExtensions::ArrayStretch
|
|
@@ -16,5 +16,5 @@ module MoreCoreExtensions
|
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
Hash.
|
|
20
|
-
Hash.
|
|
19
|
+
Hash.include MoreCoreExtensions::HashSortBang unless Hash.method_defined?(:sort!)
|
|
20
|
+
Hash.include MoreCoreExtensions::HashSortByBang unless Hash.method_defined?(:sort_by!)
|
|
@@ -97,5 +97,5 @@ module MoreCoreExtensions
|
|
|
97
97
|
end
|
|
98
98
|
end
|
|
99
99
|
|
|
100
|
-
Module.
|
|
101
|
-
Module.
|
|
100
|
+
Module.include MoreCoreExtensions::CacheWithTimeout
|
|
101
|
+
Module.extend MoreCoreExtensions::CacheWithTimeout::ClassMethods
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require "active_support/core_ext/string/inflections"
|
|
2
|
+
|
|
3
|
+
module MoreCoreExtensions
|
|
4
|
+
module StringConstantizeAllowlist
|
|
5
|
+
def self.allowed?(target, allowlist)
|
|
6
|
+
allowlist = allowlist.map { |o| o.respond_to?(:name) ? o.name : o }
|
|
7
|
+
allowlist.include?(target)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def constantize(allowlist: nil)
|
|
11
|
+
if allowlist && !StringConstantizeAllowlist.allowed?(self, allowlist)
|
|
12
|
+
raise NameError, "#{self} not found in allowlist"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
super()
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def safe_constantize(allowlist: nil)
|
|
19
|
+
if allowlist && !StringConstantizeAllowlist.allowed?(self, allowlist)
|
|
20
|
+
return nil
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
super()
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
String.prepend MoreCoreExtensions::StringConstantizeAllowlist
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module MoreCoreExtensions
|
|
2
2
|
module StringFormats
|
|
3
3
|
# From: http://www.regular-expressions.info/email.html
|
|
4
|
-
RE_EMAIL =
|
|
4
|
+
RE_EMAIL = %r{\A[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\z}i
|
|
5
5
|
|
|
6
6
|
def email?
|
|
7
7
|
!!(self =~ RE_EMAIL)
|
|
@@ -47,4 +47,4 @@ module MoreCoreExtensions
|
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
-
String.
|
|
50
|
+
String.include MoreCoreExtensions::StringFormats
|
|
@@ -81,7 +81,7 @@ module MoreCoreExtensions
|
|
|
81
81
|
end
|
|
82
82
|
end
|
|
83
83
|
|
|
84
|
-
String.
|
|
85
|
-
Numeric.
|
|
86
|
-
NilClass.
|
|
87
|
-
Object.
|
|
84
|
+
String.prepend MoreCoreExtensions::StringToIWithMethod
|
|
85
|
+
Numeric.prepend MoreCoreExtensions::NumericAndNilToIWithMethod
|
|
86
|
+
NilClass.prepend MoreCoreExtensions::NumericAndNilToIWithMethod
|
|
87
|
+
Object.prepend MoreCoreExtensions::ObjectToIWithMethod
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: more_core_extensions
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jason Frey
|
|
8
8
|
- Brandon Dunne
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -24,6 +24,20 @@ dependencies:
|
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: benchmark
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
27
41
|
- !ruby/object:Gem::Dependency
|
|
28
42
|
name: sync
|
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -131,12 +145,10 @@ executables: []
|
|
|
131
145
|
extensions: []
|
|
132
146
|
extra_rdoc_files: []
|
|
133
147
|
files:
|
|
134
|
-
- ".codeclimate.yml"
|
|
135
148
|
- ".github/workflows/ci.yaml"
|
|
136
149
|
- ".gitignore"
|
|
137
150
|
- ".rspec"
|
|
138
151
|
- ".rubocop.yml"
|
|
139
|
-
- ".rubocop_cc.yml"
|
|
140
152
|
- ".rubocop_local.yml"
|
|
141
153
|
- ".whitesource"
|
|
142
154
|
- CHANGELOG.md
|
|
@@ -188,6 +200,7 @@ files:
|
|
|
188
200
|
- lib/more_core_extensions/core_ext/range/step_value.rb
|
|
189
201
|
- lib/more_core_extensions/core_ext/shared/nested.rb
|
|
190
202
|
- lib/more_core_extensions/core_ext/string.rb
|
|
203
|
+
- lib/more_core_extensions/core_ext/string/constantize_allowlist.rb
|
|
191
204
|
- lib/more_core_extensions/core_ext/string/decimal_suffix.rb
|
|
192
205
|
- lib/more_core_extensions/core_ext/string/formats.rb
|
|
193
206
|
- lib/more_core_extensions/core_ext/string/hex_dump.rb
|
|
@@ -216,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
216
229
|
- !ruby/object:Gem::Version
|
|
217
230
|
version: '0'
|
|
218
231
|
requirements: []
|
|
219
|
-
rubygems_version:
|
|
232
|
+
rubygems_version: 4.0.7
|
|
220
233
|
specification_version: 4
|
|
221
234
|
summary: MoreCoreExtensions are a set of core extensions beyond those provided by
|
|
222
235
|
ActiveSupport.
|
data/.codeclimate.yml
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
prepare:
|
|
2
|
-
fetch:
|
|
3
|
-
- url: https://raw.githubusercontent.com/ManageIQ/manageiq-style/master/.rubocop_base.yml
|
|
4
|
-
path: ".rubocop_base.yml"
|
|
5
|
-
- url: https://raw.githubusercontent.com/ManageIQ/manageiq-style/master/.rubocop_cc_base.yml
|
|
6
|
-
path: ".rubocop_cc_base.yml"
|
|
7
|
-
- url: https://raw.githubusercontent.com/ManageIQ/manageiq-style/master/styles/base.yml
|
|
8
|
-
path: styles/base.yml
|
|
9
|
-
- url: https://raw.githubusercontent.com/ManageIQ/manageiq-style/master/styles/cc_base.yml
|
|
10
|
-
path: styles/cc_base.yml
|
|
11
|
-
plugins:
|
|
12
|
-
rubocop:
|
|
13
|
-
enabled: true
|
|
14
|
-
config: ".rubocop_cc.yml"
|
|
15
|
-
channel: rubocop-1-56-3
|
|
16
|
-
version: '2'
|
data/.rubocop_cc.yml
DELETED