fast_camelize 0.1.0 → 0.1.4

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: 8df8e6d4f213e8794d25126d2e6e3ef259fd3ca8bfd7f6a401cf2a4217a81091
4
- data.tar.gz: bf13cc73a25de18fd05beed12aca15ea3ea4bcf1d1ea034f47f62ca13912bf8d
3
+ metadata.gz: 75e1ec145c7ae7341fda1226b4df269a6020148c44bdee5847df21559b2c6331
4
+ data.tar.gz: '0906c6c49283677041ff8e67b976b564a9fc645ca982617e70bba37b4726fe85'
5
5
  SHA512:
6
- metadata.gz: fd55a665b83784a260a991c351b2d21f70fb0f458efaaca562cfdd75c6b75f84af96609b8ceaea43b8caa81fafb020175c5379ea15a56743ae20c3754428bf6a
7
- data.tar.gz: b31ee42cd8af43fa5e43e841a385c82240777dc16a61e52a75272c2b15249d119512e989eb6a11a538a9d79c75e68eab54cdc71ea226a54857a4f47e3be664ef
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.0] - 2020-10-09
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/kddeisz/fast_camelize/compare/v0.1.0...HEAD
16
- [0.1.0]: https://github.com/kddeisz/fast_camelize/compare/39c5a7...v0.1.0
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 kevin.deisz@gmail.com. All
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.0)
4
+ fast_camelize (0.1.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- activesupport (6.1.3.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.8.4)
17
- concurrent-ruby (1.1.8)
18
- docile (1.3.5)
19
- ffi (1.15.0)
20
- i18n (1.8.10)
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.0)
23
- listen (3.5.1)
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.20.1)
28
- parser (3.0.1.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.3)
32
- rake-compiler (1.1.1)
31
+ rake (13.0.6)
32
+ rake-compiler (1.1.3)
33
33
  rake
34
- rb-fsevent (0.10.4)
34
+ rb-fsevent (0.11.0)
35
35
  rb-inotify (0.10.1)
36
36
  ffi (~> 1.0)
37
- rbs (1.1.1)
38
- regexp_parser (2.1.1)
37
+ rbs (1.7.1)
38
+ regexp_parser (2.2.0)
39
39
  rexml (3.2.5)
40
- rubocop (1.12.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.2.0, < 2.0)
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.4.1)
50
- parser (>= 2.7.1.5)
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.2)
58
- steep (0.43.1)
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 (>= 2.7)
63
+ parser (>= 3.0)
64
64
  rainbow (>= 2.2.2, < 4.0)
65
- rbs (~> 1.1.0)
65
+ rbs (~> 1.7.0)
66
66
  terminal-table (>= 2, < 4)
67
- terminal-table (3.0.0)
68
- unicode-display_width (~> 1.1, >= 1.1.1)
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.7.0)
72
- zeitwerk (2.4.2)
71
+ unicode-display_width (2.1.0)
72
+ zeitwerk (2.5.1)
73
73
 
74
74
  PLATFORMS
75
75
  ruby
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2021-present Kevin Deisz
3
+ Copyright (c) 2021-present Kevin Newton
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # `String#camelize` Ruby Extension
2
2
 
3
- [![Build Status](https://github.com/kddeisz/fast_camelize/workflows/Main/badge.svg)](https://github.com/kddeisz/fast_camelize/actions)
3
+ [![Build Status](https://github.com/kddnewton/fast_camelize/workflows/Main/badge.svg)](https://github.com/kddnewton/fast_camelize/actions)
4
4
  [![Gem Version](https://img.shields.io/gem/v/fast_camelize.svg)](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/kddeisz/fast_camelize.
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
- strncpy(result + result_size, "::", 2);
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
- strncpy(result + result_size, "::", 2);
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
- strncpy(result + result_size, "::", 2);
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, true);
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);
@@ -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 = FastCamelize::VERSION
8
- spec.authors = ['Kevin Deisz']
9
- spec.email = ['kevin.deisz@gmail.com']
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 = 'https://github.com/kddeisz/fast_camelize'
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)/})
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FastCamelize
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.4'
5
5
  end
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.include(ActiveSupportInflectorPatch)
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.0
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
- - Kevin Deisz
7
+ - Kevin Newton
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-16 00:00:00.000000000 Z
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
- - kevin.deisz@gmail.com
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/kddeisz/fast_camelize
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: