camel_snake_keys 1.0.0 → 1.1.0

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: 268c6e26a8ebda25948278bcd25fe09d95406e9a2d1fd2796fbf2477b162feca
4
- data.tar.gz: 2a6ad369a5921fa673abf4b2852fbd0e442e604db94ae7599c35eeeccfe6d4f5
3
+ metadata.gz: 7a43ef9734380b43f45291290bb618394c59d90f5f4b4063971a43a3c3580fba
4
+ data.tar.gz: 23d0e08b903cf6ed0db29576f2f6fe9258b897ce93e9c2cea2c158bc0d93a142
5
5
  SHA512:
6
- metadata.gz: 629cd4305384afeb3c86d3ad586cc8e8743e8a311a0a342c758905c95fd0e7b92b7880747fdaea6d08f07d428bc6eb1c7f202997ec2df8ca7aaeb83659767f5c
7
- data.tar.gz: cb6d7ce3cd4bf786fc1e336def80a781c2091f53a8ab761e62bb414cefb5b3da7445adfc41af8c0a778fb51d2d76b1e0352e12e2dd509428b2e9075148d0c8dc
6
+ metadata.gz: a7bc99bde80faed7b2de698ade5e57b0141ad2b017f7c6d6b57f6cc038d3ca0128aded3712fd51ebb43b50debea74c8e208b167a0fa9a84f7d049881d2730f34
7
+ data.tar.gz: 3f8f91a41a00d89683b4309e771c788f6ff6ba6fc7a0d0faf7576b5ddfa6a13d23d813b03d6e856ddbe7e7dbbffa0fbadf4dd2ff374af9b519fbac1e15fb1519
data/CHANGELOG.md CHANGED
@@ -1,7 +1,11 @@
1
1
  1.0.0 01/31/2024
2
2
  ================
3
3
 
4
- Don't let integer hash keys raise your enemies up. Test against Ruby 3.3.0.
4
+ Test against Ruby 3.3.0.
5
+
6
+ Don't let integer hash keys unleashed the bees.
7
+
8
+ Fix an introduced bug that produces leading underscores when snaking PascalCase.
5
9
 
6
10
  0.1.0 10/14/2022
7
11
  ================
@@ -23,7 +23,8 @@ module CamelSnakeKeys
23
23
  end
24
24
 
25
25
  def snakecase(obj)
26
- string = +obj.to_s
26
+ string = +obj.to_s
27
+ string[0] = string[0].downcase if string[0]
27
28
  string.gsub!(/([A-Z])/) { "_#{$1}" }
28
29
  string.downcase!
29
30
  string
data/lib/version.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Store the version of the gem here rather than the gemspec
4
4
  module CamelSnakeKeys
5
- VERSION = '1.0.0'
5
+ VERSION = '1.1.0'
6
6
 
7
7
  def self.version
8
8
  VERSION
@@ -33,6 +33,11 @@ RSpec.describe Enumerable do
33
33
  CamelSnakeKeys.camelcase(nil).should eq ""
34
34
  CamelSnakeKeys.snakecase(nil).should eq ""
35
35
  end
36
+
37
+ it "handles pascal case (destructively)" do
38
+ CamelSnakeKeys.camelcase("pascal_case").should eq "pascalCase"
39
+ CamelSnakeKeys.snakecase("PascalCase").should eq "pascal_case"
40
+ end
36
41
  end
37
42
 
38
43
  context 'arrays' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: camel_snake_keys
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Buermann