fast_camelize 0.1.0 → 0.1.4
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/CHANGELOG.md +31 -3
- data/CODE_OF_CONDUCT.md +1 -1
- data/Gemfile.lock +28 -28
- data/LICENSE +1 -1
- data/README.md +2 -2
- data/ext/fast_camelize/fast_camelize.c +4 -4
- data/fast_camelize.gemspec +14 -4
- data/lib/fast_camelize/version.rb +1 -1
- data/lib/fast_camelize.rb +22 -1
- metadata +10 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75e1ec145c7ae7341fda1226b4df269a6020148c44bdee5847df21559b2c6331
|
4
|
+
data.tar.gz: '0906c6c49283677041ff8e67b976b564a9fc645ca982617e70bba37b4726fe85'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ac5b42056aa887f3d91508d7fb215157e1c3bc4f2ff868a1f4aa0d16e3a713c0e8758ad58986f5b013a2064b6ce431b33aafbe34ea69cbd40bb1fa95ec5e8d4
|
7
|
+
data.tar.gz: 464197ac75a362dff0b1931090637b5b1cb77f1d3dec4d4743c6e6d3814596a42dfaa18ae8fac5cea3880a952b75ce53890e6061d967548fa7c7810893b53c94
|
data/CHANGELOG.md
CHANGED
@@ -6,11 +6,39 @@ 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.1.
|
9
|
+
## [0.1.4] - 2021-12-09
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
|
13
|
+
- Change `strncpy` instances to `memcpy` when the string isn't null terminated to avoid warnings.
|
14
|
+
|
15
|
+
## [0.1.3] - 2021-11-17
|
16
|
+
|
17
|
+
### Changed
|
18
|
+
|
19
|
+
- Require MFA for releasing.
|
20
|
+
|
21
|
+
## [0.1.2] - 2021-04-16
|
22
|
+
|
23
|
+
### Changed
|
24
|
+
|
25
|
+
- Ensure we patch String again so that it uses the ActiveSupport version.
|
26
|
+
|
27
|
+
## [0.1.1] - 2021-04-16
|
28
|
+
|
29
|
+
### Changed
|
30
|
+
|
31
|
+
- Better documentation and ensure we only capitalize non-start segments.
|
32
|
+
|
33
|
+
## [0.1.0] - 2021-04-16
|
10
34
|
|
11
35
|
### Added
|
12
36
|
|
13
37
|
- 🎉 Initial release! 🎉
|
14
38
|
|
15
|
-
[unreleased]: https://github.com/
|
16
|
-
[0.1.
|
39
|
+
[unreleased]: https://github.com/kddnewton/fast_camelize/compare/v0.1.4...HEAD
|
40
|
+
[0.1.4]: https://github.com/kddnewton/fast_camelize/compare/v0.1.3...v0.1.4
|
41
|
+
[0.1.3]: https://github.com/kddnewton/fast_camelize/compare/v0.1.2...v0.1.3
|
42
|
+
[0.1.2]: https://github.com/kddnewton/fast_camelize/compare/v0.1.1...v0.1.2
|
43
|
+
[0.1.1]: https://github.com/kddnewton/fast_camelize/compare/v0.1.0...v0.1.1
|
44
|
+
[0.1.0]: https://github.com/kddnewton/fast_camelize/compare/384d75...v0.1.0
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
|
|
55
55
|
## Enforcement
|
56
56
|
|
57
57
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at
|
58
|
+
reported by contacting the project team at kddnewton@gmail.com. All
|
59
59
|
complaints will be reviewed and investigated and will result in a response that
|
60
60
|
is deemed necessary and appropriate to the circumstances. The project team is
|
61
61
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
data/Gemfile.lock
CHANGED
@@ -1,75 +1,75 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fast_camelize (0.1.
|
4
|
+
fast_camelize (0.1.4)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
activesupport (6.1.
|
9
|
+
activesupport (6.1.4.1)
|
10
10
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
11
11
|
i18n (>= 1.6, < 2)
|
12
12
|
minitest (>= 5.1)
|
13
13
|
tzinfo (~> 2.0)
|
14
14
|
zeitwerk (~> 2.3)
|
15
15
|
ast (2.4.2)
|
16
|
-
benchmark-ips (2.
|
17
|
-
concurrent-ruby (1.1.
|
18
|
-
docile (1.
|
19
|
-
ffi (1.15.
|
20
|
-
i18n (1.8.
|
16
|
+
benchmark-ips (2.9.2)
|
17
|
+
concurrent-ruby (1.1.9)
|
18
|
+
docile (1.4.0)
|
19
|
+
ffi (1.15.4)
|
20
|
+
i18n (1.8.11)
|
21
21
|
concurrent-ruby (~> 1.0)
|
22
|
-
language_server-protocol (3.16.0.
|
23
|
-
listen (3.
|
22
|
+
language_server-protocol (3.16.0.3)
|
23
|
+
listen (3.7.0)
|
24
24
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
25
25
|
rb-inotify (~> 0.9, >= 0.9.10)
|
26
26
|
minitest (5.14.4)
|
27
|
-
parallel (1.
|
28
|
-
parser (3.0.
|
27
|
+
parallel (1.21.0)
|
28
|
+
parser (3.0.3.2)
|
29
29
|
ast (~> 2.4.1)
|
30
30
|
rainbow (3.0.0)
|
31
|
-
rake (13.0.
|
32
|
-
rake-compiler (1.1.
|
31
|
+
rake (13.0.6)
|
32
|
+
rake-compiler (1.1.3)
|
33
33
|
rake
|
34
|
-
rb-fsevent (0.
|
34
|
+
rb-fsevent (0.11.0)
|
35
35
|
rb-inotify (0.10.1)
|
36
36
|
ffi (~> 1.0)
|
37
|
-
rbs (1.
|
38
|
-
regexp_parser (2.
|
37
|
+
rbs (1.7.1)
|
38
|
+
regexp_parser (2.2.0)
|
39
39
|
rexml (3.2.5)
|
40
|
-
rubocop (1.
|
40
|
+
rubocop (1.23.0)
|
41
41
|
parallel (~> 1.10)
|
42
42
|
parser (>= 3.0.0.0)
|
43
43
|
rainbow (>= 2.2.2, < 4.0)
|
44
44
|
regexp_parser (>= 1.8, < 3.0)
|
45
45
|
rexml
|
46
|
-
rubocop-ast (>= 1.
|
46
|
+
rubocop-ast (>= 1.12.0, < 2.0)
|
47
47
|
ruby-progressbar (~> 1.7)
|
48
48
|
unicode-display_width (>= 1.4.0, < 3.0)
|
49
|
-
rubocop-ast (1.
|
50
|
-
parser (>=
|
49
|
+
rubocop-ast (1.14.0)
|
50
|
+
parser (>= 3.0.1.1)
|
51
51
|
ruby-progressbar (1.11.0)
|
52
52
|
simplecov (0.21.2)
|
53
53
|
docile (~> 1.1)
|
54
54
|
simplecov-html (~> 0.11)
|
55
55
|
simplecov_json_formatter (~> 0.1)
|
56
56
|
simplecov-html (0.12.3)
|
57
|
-
simplecov_json_formatter (0.1.
|
58
|
-
steep (0.
|
57
|
+
simplecov_json_formatter (0.1.3)
|
58
|
+
steep (0.47.0)
|
59
59
|
activesupport (>= 5.1)
|
60
60
|
language_server-protocol (>= 3.15, < 4.0)
|
61
61
|
listen (~> 3.0)
|
62
62
|
parallel (>= 1.0.0)
|
63
|
-
parser (>=
|
63
|
+
parser (>= 3.0)
|
64
64
|
rainbow (>= 2.2.2, < 4.0)
|
65
|
-
rbs (~> 1.
|
65
|
+
rbs (~> 1.7.0)
|
66
66
|
terminal-table (>= 2, < 4)
|
67
|
-
terminal-table (3.0.
|
68
|
-
unicode-display_width (
|
67
|
+
terminal-table (3.0.2)
|
68
|
+
unicode-display_width (>= 1.1.1, < 3)
|
69
69
|
tzinfo (2.0.4)
|
70
70
|
concurrent-ruby (~> 1.0)
|
71
|
-
unicode-display_width (1.
|
72
|
-
zeitwerk (2.
|
71
|
+
unicode-display_width (2.1.0)
|
72
|
+
zeitwerk (2.5.1)
|
73
73
|
|
74
74
|
PLATFORMS
|
75
75
|
ruby
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# `String#camelize` Ruby Extension
|
2
2
|
|
3
|
-
[](https://github.com/kddnewton/fast_camelize/actions)
|
4
4
|
[](https://rubygems.org/gems/fast_camelize)
|
5
5
|
|
6
6
|
`fast_camelize` is a C extension that provides a fast implementation of [ActiveSupport's `String#camelize` method](http://api.rubyonrails.org/classes/String.html#method-i-camelize).
|
@@ -46,7 +46,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
46
46
|
|
47
47
|
## Contributing
|
48
48
|
|
49
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
49
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/kddnewton/fast_camelize.
|
50
50
|
|
51
51
|
## License
|
52
52
|
|
@@ -112,7 +112,7 @@ static VALUE camelize(VALUE string, VALUE kwargs) {
|
|
112
112
|
copy_segment(result, &result_size, segment, &segment_size, acronyms, false);
|
113
113
|
}
|
114
114
|
if (codepoint == '/') {
|
115
|
-
|
115
|
+
memcpy(result + result_size, "::", 2);
|
116
116
|
result_size += 2;
|
117
117
|
}
|
118
118
|
state = STATE_SEGSTART;
|
@@ -123,7 +123,7 @@ static VALUE camelize(VALUE string, VALUE kwargs) {
|
|
123
123
|
if (codepoint == '_') {
|
124
124
|
// do nothing
|
125
125
|
} else if (codepoint == '/') {
|
126
|
-
|
126
|
+
memcpy(result + result_size, "::", 2);
|
127
127
|
result_size += 2;
|
128
128
|
} else if (isasciialnum(codepoint)) {
|
129
129
|
segment[segment_size++] = codepoint;
|
@@ -143,7 +143,7 @@ static VALUE camelize(VALUE string, VALUE kwargs) {
|
|
143
143
|
if (codepoint == '_') {
|
144
144
|
state = STATE_SEGSTART;
|
145
145
|
} else if (codepoint == '/') {
|
146
|
-
|
146
|
+
memcpy(result + result_size, "::", 2);
|
147
147
|
result_size += 2;
|
148
148
|
state = STATE_SEGSTART;
|
149
149
|
} else {
|
@@ -159,7 +159,7 @@ static VALUE camelize(VALUE string, VALUE kwargs) {
|
|
159
159
|
// If we're in the DEFAULT or SEGBODY state, then we need to flush out the
|
160
160
|
// remaining segment.
|
161
161
|
if ((state == STATE_SEGBODY || state == STATE_DEFAULT) && segment_size > 0) {
|
162
|
-
copy_segment(result, &result_size, segment, &segment_size, acronyms,
|
162
|
+
copy_segment(result, &result_size, segment, &segment_size, acronyms, state == STATE_SEGBODY);
|
163
163
|
}
|
164
164
|
|
165
165
|
return rb_enc_str_new(result, result_size, encoding);
|
data/fast_camelize.gemspec
CHANGED
@@ -2,17 +2,27 @@
|
|
2
2
|
|
3
3
|
require_relative 'lib/fast_camelize/version'
|
4
4
|
|
5
|
+
version = FastCamelize::VERSION
|
6
|
+
repository = 'https://github.com/kddnewton/fast_camelize'
|
7
|
+
|
5
8
|
Gem::Specification.new do |spec|
|
6
9
|
spec.name = 'fast_camelize'
|
7
|
-
spec.version =
|
8
|
-
spec.authors = ['Kevin
|
9
|
-
spec.email = ['
|
10
|
+
spec.version = version
|
11
|
+
spec.authors = ['Kevin Newton']
|
12
|
+
spec.email = ['kddnewton@gmail.com']
|
10
13
|
|
11
14
|
spec.summary = 'Fast String#camelize implementation'
|
12
15
|
spec.description = 'Provides a C-optimized method for camelizing a string'
|
13
|
-
spec.homepage =
|
16
|
+
spec.homepage = repository
|
14
17
|
spec.license = 'MIT'
|
15
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
|
+
}
|
25
|
+
|
16
26
|
spec.files = Dir.chdir(__dir__) do
|
17
27
|
`git ls-files -z`.split("\x0").reject do |f|
|
18
28
|
f.match(%r{^(test|spec|features)/})
|
data/lib/fast_camelize.rb
CHANGED
@@ -32,6 +32,26 @@ module FastCamelize
|
|
32
32
|
# rubocop:disable all
|
33
33
|
end
|
34
34
|
|
35
|
+
# Override String#camelize if we need to get back to the original behavior
|
36
|
+
# that fast_camelize overroad.
|
37
|
+
module ActiveSupportStringPatch
|
38
|
+
def camelize(first_letter = :upper)
|
39
|
+
case first_letter
|
40
|
+
when :upper
|
41
|
+
ActiveSupport::Inflector.camelize(self, true)
|
42
|
+
when :lower
|
43
|
+
ActiveSupport::Inflector.camelize(self, false)
|
44
|
+
else
|
45
|
+
# Skipping here because Steep doesn't understand that this is going to
|
46
|
+
# be included into a class that has Kernel included.
|
47
|
+
__skip__ =
|
48
|
+
begin
|
49
|
+
raise ArgumentError, 'Invalid option, use either :upper or :lower.'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
35
55
|
# Override ActiveSupport::Inflector::method_added so that if and when the
|
36
56
|
# camelize method gets defined, we can immediately redefine it.
|
37
57
|
module ActiveSupportDelayedPatch
|
@@ -44,7 +64,8 @@ module FastCamelize
|
|
44
64
|
# Hook into ActiveSupport::Inflector to take advantage of FastCamelize.
|
45
65
|
def self.active_support
|
46
66
|
ActiveSupport::Inflector.alias_method(:as_camelize, :camelize)
|
47
|
-
ActiveSupport::Inflector.
|
67
|
+
ActiveSupport::Inflector.prepend(ActiveSupportInflectorPatch)
|
68
|
+
String.prepend(ActiveSupportStringPatch)
|
48
69
|
end
|
49
70
|
end
|
50
71
|
|
metadata
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fast_camelize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Kevin
|
7
|
+
- Kevin Newton
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Provides a C-optimized method for camelizing a string
|
14
14
|
email:
|
15
|
-
-
|
15
|
+
- kddnewton@gmail.com
|
16
16
|
executables: []
|
17
17
|
extensions:
|
18
18
|
- ext/fast_camelize/extconf.rb
|
@@ -39,10 +39,14 @@ files:
|
|
39
39
|
- lib/fast_camelize.rb
|
40
40
|
- lib/fast_camelize/version.rb
|
41
41
|
- sig/fast_camelize.rbs
|
42
|
-
homepage: https://github.com/
|
42
|
+
homepage: https://github.com/kddnewton/fast_camelize
|
43
43
|
licenses:
|
44
44
|
- MIT
|
45
|
-
metadata:
|
45
|
+
metadata:
|
46
|
+
bug_tracker_uri: https://github.com/kddnewton/fast_camelize/issues
|
47
|
+
changelog_uri: https://github.com/kddnewton/fast_camelize/blob/v0.1.4/CHANGELOG.md
|
48
|
+
source_code_uri: https://github.com/kddnewton/fast_camelize
|
49
|
+
rubygems_mfa_required: 'true'
|
46
50
|
post_install_message:
|
47
51
|
rdoc_options: []
|
48
52
|
require_paths:
|