fast_camelize 0.1.0 → 0.1.1

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: d2c8b7e5c206059c52331f7a44759865759ff1f28fe4ad53de359af473e44133
4
+ data.tar.gz: b124786ba169d38ac73f2fdb8a4dc91119ff000b91de1fd1defdb63fc6a44444
5
5
  SHA512:
6
- metadata.gz: fd55a665b83784a260a991c351b2d21f70fb0f458efaaca562cfdd75c6b75f84af96609b8ceaea43b8caa81fafb020175c5379ea15a56743ae20c3754428bf6a
7
- data.tar.gz: b31ee42cd8af43fa5e43e841a385c82240777dc16a61e52a75272c2b15249d119512e989eb6a11a538a9d79c75e68eab54cdc71ea226a54857a4f47e3be664ef
6
+ metadata.gz: 7fb8679402babf736efed793213bbbdcbe89771788848e6b6a52285783d05c4b54c3f9b82dab9c0e7a5fdf001f5a87c84c51f7fc428619fbbe4cbb77fb66f058
7
+ data.tar.gz: b28d9ad3d8b4beeebdea450345594b6e8ae9979b56fbb5123bb938f41fe752b48f01e7fa80c815143c95277e55dcfb8d0994f418cd34e9616b3f5e7f511ff09f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fast_camelize (0.1.0)
4
+ fast_camelize (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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);
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
@@ -45,6 +65,7 @@ module FastCamelize
45
65
  def self.active_support
46
66
  ActiveSupport::Inflector.alias_method(:as_camelize, :camelize)
47
67
  ActiveSupport::Inflector.include(ActiveSupportInflectorPatch)
68
+ String.include(ActiveSupportStringPatch)
48
69
  end
49
70
  end
50
71
 
@@ -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.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Deisz