fast_underscore 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -1
- data/README.md +1 -1
- data/ext/fast_underscore/extconf.rb +2 -2
- data/fast_underscore.gemspec +41 -33
- data/lib/fast_underscore/version.rb +1 -1
- data/lib/fast_underscore.rb +7 -7
- metadata +20 -22
- data/.github/dependabot.yml +0 -6
- data/.github/workflows/main.yml +0 -44
- data/.gitignore +0 -11
- data/.rubocop.yml +0 -30
- data/Gemfile +0 -7
- data/Gemfile.lock +0 -82
- data/Rakefile +0 -22
- data/Steepfile +0 -6
- data/bin/bench +0 -24
- data/bin/console +0 -8
- data/bin/setup +0 -6
- data/gemfiles/5.1.gemfile +0 -7
- data/gemfiles/5.2.gemfile +0 -7
- data/gemfiles/6.0.gemfile +0 -7
- data/gemfiles/6.1.gemfile +0 -7
- data/sig/fast_underscore.rbs +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19f7d80999c34375fec07a65c9508caa62532ab60013eb7f14185ff1ff59c3f9
|
4
|
+
data.tar.gz: e1079092105d5ce4ef58957d000e12206f053b471a7f4535ed7f72fbb59913fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a73bb48fdcbad7d4c3791119f21bba127aeba1400aa4c7baa107162ea8c7de0bb84485502491670febb6698e78e99fa3ef1cdaa32cdcc6c1ffc7f5a12203b9c4
|
7
|
+
data.tar.gz: 6bc9a730ad636a5904fe2136f3f29822c5dc25bd570f129131d4619f19f4fd31939c0d01db31873367d8b471fc4de54e25fdd8ac71fd460e3c047aba6bbd9f6f
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [0.3.4] - 2024-05-25
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
|
13
|
+
- Trim files from built artifact.
|
14
|
+
|
9
15
|
## [0.3.3] - 2021-11-17
|
10
16
|
|
11
17
|
### Changed
|
@@ -42,7 +48,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
|
|
42
48
|
|
43
49
|
- Support for the Rails 5.2 beta.
|
44
50
|
|
45
|
-
[unreleased]: https://github.com/kddnewton/fast_underscore/compare/v0.3.
|
51
|
+
[unreleased]: https://github.com/kddnewton/fast_underscore/compare/v0.3.4...HEAD
|
52
|
+
[0.3.4]: https://github.com/kddnewton/fast_underscore/compare/v0.3.3...v0.3.4
|
46
53
|
[0.3.3]: https://github.com/kddnewton/fast_underscore/compare/v0.3.2...v0.3.3
|
47
54
|
[0.3.2]: https://github.com/kddnewton/fast_underscore/compare/v0.3.1...v0.3.2
|
48
55
|
[0.3.1]: https://github.com/kddnewton/fast_underscore/compare/v0.3.0...v0.3.1
|
data/README.md
CHANGED
data/fast_underscore.gemspec
CHANGED
@@ -1,42 +1,50 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative "lib/fast_underscore/version"
|
4
4
|
|
5
5
|
version = FastUnderscore::VERSION
|
6
|
-
repository =
|
6
|
+
repository = "https://github.com/kddnewton/fast_underscore"
|
7
7
|
|
8
8
|
Gem::Specification.new do |spec|
|
9
|
-
spec.name
|
10
|
-
spec.version
|
11
|
-
spec.authors
|
12
|
-
spec.email
|
13
|
-
|
14
|
-
spec.summary
|
15
|
-
spec.description
|
16
|
-
spec.homepage
|
17
|
-
spec.license
|
18
|
-
|
19
|
-
spec.metadata
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
9
|
+
spec.name = "fast_underscore"
|
10
|
+
spec.version = version
|
11
|
+
spec.authors = ["Kevin Newton"]
|
12
|
+
spec.email = ["kddnewton@gmail.com"]
|
13
|
+
|
14
|
+
spec.summary = "Fast String#underscore implementation"
|
15
|
+
spec.description = "Provides a C-optimized method for underscoring a string"
|
16
|
+
spec.homepage = repository
|
17
|
+
spec.license = "MIT"
|
18
|
+
|
19
|
+
spec.metadata = {
|
20
|
+
"bug_tracker_uri" => "#{repository}/issues",
|
21
|
+
"changelog_uri" => "#{repository}/blob/v#{version}/CHANGELOG.md",
|
22
|
+
"source_code_uri" => repository,
|
23
|
+
"rubygems_mfa_required" => "true"
|
24
24
|
}
|
25
25
|
|
26
|
-
spec.files =
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
spec.
|
40
|
-
spec.
|
41
|
-
|
26
|
+
spec.files = [
|
27
|
+
"CHANGELOG.md",
|
28
|
+
"CODE_OF_CONDUCT.md",
|
29
|
+
"LICENSE",
|
30
|
+
"README.md",
|
31
|
+
"ext/fast_underscore/extconf.rb",
|
32
|
+
"ext/fast_underscore/fast_underscore.c",
|
33
|
+
"ext/fast_underscore/fast_underscore.h",
|
34
|
+
"fast_underscore.gemspec",
|
35
|
+
"lib/fast_underscore.rb",
|
36
|
+
"lib/fast_underscore/version.rb"
|
37
|
+
]
|
38
|
+
|
39
|
+
spec.require_paths = ["lib"]
|
40
|
+
spec.extensions = ["ext/fast_underscore/extconf.rb"]
|
41
|
+
|
42
|
+
spec.add_development_dependency "benchmark-ips", "~> 2"
|
43
|
+
spec.add_development_dependency "bundler", "~> 2"
|
44
|
+
spec.add_development_dependency "minitest", "~> 5"
|
45
|
+
spec.add_development_dependency "rake", "~> 13"
|
46
|
+
spec.add_development_dependency "rake-compiler", "~> 1"
|
47
|
+
spec.add_development_dependency "rubocop", "~> 1.12"
|
48
|
+
spec.add_development_dependency "ruby_memcheck"
|
49
|
+
spec.add_development_dependency "syntax_tree"
|
42
50
|
end
|
data/lib/fast_underscore.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "fast_underscore/version"
|
4
|
+
require "fast_underscore/fast_underscore"
|
5
5
|
|
6
6
|
module FastUnderscore
|
7
7
|
# Override ActiveSupport::Inflector::underscore to use
|
@@ -19,7 +19,7 @@ module FastUnderscore
|
|
19
19
|
|
20
20
|
response = string.dup
|
21
21
|
response.gsub!(ActiveSupportInflectorOldPatch.pattern) do
|
22
|
-
"#{$1 &&
|
22
|
+
"#{$1 && "_"}#{$2.downcase}"
|
23
23
|
end
|
24
24
|
|
25
25
|
FastUnderscore.underscore(response)
|
@@ -35,7 +35,7 @@ module FastUnderscore
|
|
35
35
|
response = string.dup
|
36
36
|
acronyms = ActiveSupport::Inflector.inflections.acronyms_underscore_regex
|
37
37
|
|
38
|
-
response.gsub!(acronyms) { "#{$1 &&
|
38
|
+
response.gsub!(acronyms) { "#{$1 && "_"}#{$2.downcase}" }
|
39
39
|
|
40
40
|
FastUnderscore.underscore(response)
|
41
41
|
end
|
@@ -51,7 +51,7 @@ module FastUnderscore
|
|
51
51
|
end
|
52
52
|
|
53
53
|
# Override the String#underscore method no matter when it was defined so that
|
54
|
-
# we
|
54
|
+
# we"re sure it"s going to call the correct implementation.
|
55
55
|
module ActiveSupportStringPatch
|
56
56
|
def underscore
|
57
57
|
ActiveSupport::Inflector.underscore(self)
|
@@ -63,10 +63,10 @@ module FastUnderscore
|
|
63
63
|
# ActiveSupport::Inflector::underscore method to use the FastUnderscore
|
64
64
|
# native extension.
|
65
65
|
def self.active_support
|
66
|
-
require
|
66
|
+
require "active_support/version"
|
67
67
|
gem_version = Gem::Version.new(ActiveSupport::VERSION::STRING)
|
68
68
|
|
69
|
-
if gem_version >= Gem::Version.new(
|
69
|
+
if gem_version >= Gem::Version.new("5.2.0")
|
70
70
|
ActiveSupport::Inflector.prepend(ActiveSupportInflectorPatch)
|
71
71
|
else
|
72
72
|
ActiveSupport::Inflector.prepend(ActiveSupportInflectorOldPatch)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fast_underscore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Newton
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: benchmark-ips
|
@@ -95,7 +95,21 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '1.12'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: ruby_memcheck
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: syntax_tree
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - ">="
|
@@ -116,38 +130,22 @@ extensions:
|
|
116
130
|
- ext/fast_underscore/extconf.rb
|
117
131
|
extra_rdoc_files: []
|
118
132
|
files:
|
119
|
-
- ".github/dependabot.yml"
|
120
|
-
- ".github/workflows/main.yml"
|
121
|
-
- ".gitignore"
|
122
|
-
- ".rubocop.yml"
|
123
133
|
- CHANGELOG.md
|
124
134
|
- CODE_OF_CONDUCT.md
|
125
|
-
- Gemfile
|
126
|
-
- Gemfile.lock
|
127
135
|
- LICENSE
|
128
136
|
- README.md
|
129
|
-
- Rakefile
|
130
|
-
- Steepfile
|
131
|
-
- bin/bench
|
132
|
-
- bin/console
|
133
|
-
- bin/setup
|
134
137
|
- ext/fast_underscore/extconf.rb
|
135
138
|
- ext/fast_underscore/fast_underscore.c
|
136
139
|
- ext/fast_underscore/fast_underscore.h
|
137
140
|
- fast_underscore.gemspec
|
138
|
-
- gemfiles/5.1.gemfile
|
139
|
-
- gemfiles/5.2.gemfile
|
140
|
-
- gemfiles/6.0.gemfile
|
141
|
-
- gemfiles/6.1.gemfile
|
142
141
|
- lib/fast_underscore.rb
|
143
142
|
- lib/fast_underscore/version.rb
|
144
|
-
- sig/fast_underscore.rbs
|
145
143
|
homepage: https://github.com/kddnewton/fast_underscore
|
146
144
|
licenses:
|
147
145
|
- MIT
|
148
146
|
metadata:
|
149
147
|
bug_tracker_uri: https://github.com/kddnewton/fast_underscore/issues
|
150
|
-
changelog_uri: https://github.com/kddnewton/fast_underscore/blob/v0.3.
|
148
|
+
changelog_uri: https://github.com/kddnewton/fast_underscore/blob/v0.3.4/CHANGELOG.md
|
151
149
|
source_code_uri: https://github.com/kddnewton/fast_underscore
|
152
150
|
rubygems_mfa_required: 'true'
|
153
151
|
post_install_message:
|
@@ -165,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
163
|
- !ruby/object:Gem::Version
|
166
164
|
version: '0'
|
167
165
|
requirements: []
|
168
|
-
rubygems_version: 3.
|
166
|
+
rubygems_version: 3.6.0.dev
|
169
167
|
signing_key:
|
170
168
|
specification_version: 4
|
171
169
|
summary: Fast String#underscore implementation
|
data/.github/dependabot.yml
DELETED
data/.github/workflows/main.yml
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
name: Main
|
2
|
-
on:
|
3
|
-
- push
|
4
|
-
- pull_request_target
|
5
|
-
jobs:
|
6
|
-
ci:
|
7
|
-
name: CI
|
8
|
-
runs-on: ubuntu-latest
|
9
|
-
strategy:
|
10
|
-
fail-fast: false
|
11
|
-
matrix:
|
12
|
-
gemfile:
|
13
|
-
- "5.1"
|
14
|
-
- "5.2"
|
15
|
-
- "6.0"
|
16
|
-
- "6.1"
|
17
|
-
env:
|
18
|
-
CI: true
|
19
|
-
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
|
20
|
-
steps:
|
21
|
-
- uses: actions/checkout@master
|
22
|
-
- uses: ruby/setup-ruby@v1
|
23
|
-
with:
|
24
|
-
ruby-version: 3.0
|
25
|
-
bundler-cache: true
|
26
|
-
- name: Lint and test
|
27
|
-
run: |
|
28
|
-
bundle exec rubocop --parallel
|
29
|
-
bundle exec rake test
|
30
|
-
bundle exec steep check
|
31
|
-
automerge:
|
32
|
-
name: AutoMerge
|
33
|
-
needs: ci
|
34
|
-
runs-on: ubuntu-latest
|
35
|
-
if: github.event_name == 'pull_request_target' && (github.actor == github.repository_owner || github.actor == 'dependabot[bot]')
|
36
|
-
steps:
|
37
|
-
- uses: actions/github-script@v3
|
38
|
-
with:
|
39
|
-
script: |
|
40
|
-
github.pulls.merge({
|
41
|
-
owner: context.payload.repository.owner.login,
|
42
|
-
repo: context.payload.repository.name,
|
43
|
-
pull_number: context.payload.pull_request.number
|
44
|
-
})
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
DisplayCopNames: true
|
3
|
-
DisplayStyleGuide: true
|
4
|
-
TargetRubyVersion: 2.7
|
5
|
-
Exclude:
|
6
|
-
- '{tmp,vendor,yard}/**/*'
|
7
|
-
|
8
|
-
Gemspec/RequiredRubyVersion:
|
9
|
-
Enabled: false
|
10
|
-
|
11
|
-
Layout/LineLength:
|
12
|
-
Max: 80
|
13
|
-
|
14
|
-
Lint/AmbiguousBlockAssociation:
|
15
|
-
Enabled: false
|
16
|
-
|
17
|
-
Naming/RescuedExceptionsVariableName:
|
18
|
-
Enabled: false
|
19
|
-
|
20
|
-
Style/Documentation:
|
21
|
-
Enabled: false
|
22
|
-
|
23
|
-
Style/FormatString:
|
24
|
-
EnforcedStyle: percent
|
25
|
-
|
26
|
-
Style/FormatStringToken:
|
27
|
-
Enabled: false
|
28
|
-
|
29
|
-
Style/PerlBackrefs:
|
30
|
-
Enabled: false
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
fast_underscore (0.3.3)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
activesupport (6.1.4.1)
|
10
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
11
|
-
i18n (>= 1.6, < 2)
|
12
|
-
minitest (>= 5.1)
|
13
|
-
tzinfo (~> 2.0)
|
14
|
-
zeitwerk (~> 2.3)
|
15
|
-
ast (2.4.2)
|
16
|
-
benchmark-ips (2.9.2)
|
17
|
-
concurrent-ruby (1.1.9)
|
18
|
-
ffi (1.15.4)
|
19
|
-
i18n (1.8.11)
|
20
|
-
concurrent-ruby (~> 1.0)
|
21
|
-
language_server-protocol (3.16.0.3)
|
22
|
-
listen (3.7.0)
|
23
|
-
rb-fsevent (~> 0.10, >= 0.10.3)
|
24
|
-
rb-inotify (~> 0.9, >= 0.9.10)
|
25
|
-
minitest (5.14.4)
|
26
|
-
parallel (1.21.0)
|
27
|
-
parser (3.0.2.0)
|
28
|
-
ast (~> 2.4.1)
|
29
|
-
rainbow (3.0.0)
|
30
|
-
rake (13.0.6)
|
31
|
-
rake-compiler (1.1.1)
|
32
|
-
rake
|
33
|
-
rb-fsevent (0.11.0)
|
34
|
-
rb-inotify (0.10.1)
|
35
|
-
ffi (~> 1.0)
|
36
|
-
rbs (1.7.0)
|
37
|
-
regexp_parser (2.1.1)
|
38
|
-
rexml (3.2.5)
|
39
|
-
rubocop (1.23.0)
|
40
|
-
parallel (~> 1.10)
|
41
|
-
parser (>= 3.0.0.0)
|
42
|
-
rainbow (>= 2.2.2, < 4.0)
|
43
|
-
regexp_parser (>= 1.8, < 3.0)
|
44
|
-
rexml
|
45
|
-
rubocop-ast (>= 1.12.0, < 2.0)
|
46
|
-
ruby-progressbar (~> 1.7)
|
47
|
-
unicode-display_width (>= 1.4.0, < 3.0)
|
48
|
-
rubocop-ast (1.13.0)
|
49
|
-
parser (>= 3.0.1.1)
|
50
|
-
ruby-progressbar (1.11.0)
|
51
|
-
steep (0.46.0)
|
52
|
-
activesupport (>= 5.1)
|
53
|
-
language_server-protocol (>= 3.15, < 4.0)
|
54
|
-
listen (~> 3.0)
|
55
|
-
parallel (>= 1.0.0)
|
56
|
-
parser (>= 3.0)
|
57
|
-
rainbow (>= 2.2.2, < 4.0)
|
58
|
-
rbs (>= 1.2.0)
|
59
|
-
terminal-table (>= 2, < 4)
|
60
|
-
terminal-table (3.0.2)
|
61
|
-
unicode-display_width (>= 1.1.1, < 3)
|
62
|
-
tzinfo (2.0.4)
|
63
|
-
concurrent-ruby (~> 1.0)
|
64
|
-
unicode-display_width (2.1.0)
|
65
|
-
zeitwerk (2.5.1)
|
66
|
-
|
67
|
-
PLATFORMS
|
68
|
-
ruby
|
69
|
-
|
70
|
-
DEPENDENCIES
|
71
|
-
activesupport (~> 6.1)
|
72
|
-
benchmark-ips (~> 2)
|
73
|
-
bundler (~> 2)
|
74
|
-
fast_underscore!
|
75
|
-
minitest (~> 5)
|
76
|
-
rake (~> 13)
|
77
|
-
rake-compiler (~> 1)
|
78
|
-
rubocop (~> 1.12)
|
79
|
-
steep
|
80
|
-
|
81
|
-
BUNDLED WITH
|
82
|
-
2.2.3
|
data/Rakefile
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'bundler/gem_tasks'
|
4
|
-
require 'rake/testtask'
|
5
|
-
require 'rake/extensiontask'
|
6
|
-
|
7
|
-
Rake::ExtensionTask.new(:compile) do |ext|
|
8
|
-
ext.name = 'fast_underscore'
|
9
|
-
ext.ext_dir = 'ext/fast_underscore'
|
10
|
-
ext.lib_dir = 'lib/fast_underscore'
|
11
|
-
ext.gem_spec = Gem::Specification.load('fast_underscore.gemspec')
|
12
|
-
end
|
13
|
-
|
14
|
-
Rake::TestTask.new(:test) do |t|
|
15
|
-
t.libs << 'test'
|
16
|
-
t.libs << 'lib'
|
17
|
-
t.test_files = FileList['test/**/*_test.rb']
|
18
|
-
end
|
19
|
-
|
20
|
-
Rake::Task[:test].prerequisites << :compile
|
21
|
-
|
22
|
-
task default: :test
|
data/Steepfile
DELETED
data/bin/bench
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require 'bundler/setup'
|
5
|
-
require 'benchmark/ips'
|
6
|
-
|
7
|
-
require 'fast_underscore'
|
8
|
-
require 'active_support'
|
9
|
-
|
10
|
-
source =
|
11
|
-
%w[_ - : :: / 漢字 😊🎉] + ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a
|
12
|
-
words = 500.times.map { Array.new(100) { source.sample }.join }
|
13
|
-
|
14
|
-
Benchmark.ips do |x|
|
15
|
-
x.report('ActiveSupport') do
|
16
|
-
words.each { |word| ActiveSupport::Inflector.as_underscore(word) }
|
17
|
-
end
|
18
|
-
|
19
|
-
x.report('FastUnderscore') do
|
20
|
-
words.each { |word| FastUnderscore.underscore(word) }
|
21
|
-
end
|
22
|
-
|
23
|
-
x.compare!
|
24
|
-
end
|
data/bin/console
DELETED
data/bin/setup
DELETED
data/gemfiles/5.1.gemfile
DELETED
data/gemfiles/5.2.gemfile
DELETED
data/gemfiles/6.0.gemfile
DELETED
data/gemfiles/6.1.gemfile
DELETED