simple_symbolize 2.0.0 → 2.0.2

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: 1e23023a3bb1c8d394ba3059e5e72d0fef3480b5c0f09900aa9d00e61d784058
4
- data.tar.gz: 557b65ea91d5db0400dd5aa23b66894d9fe5576962bfc7c1bf9895337ccfc093
3
+ metadata.gz: 6b0904a9e68211c27ef36b9f8e05fd2966963db4aff8c875fae76138ce7e08f4
4
+ data.tar.gz: 92cf5435b255b07461f0d13bd122d3257f6f869bcf6b95d08d9b67b9805a96c1
5
5
  SHA512:
6
- metadata.gz: 67ef8dd2fa3215f422fe90ec76f86da67a61f6801a3f6cc1ef9cfb763136d2fe52ba561ab0339e80eab120c16ab0c03f1841868abc9101a61d8f55d45fd3c123
7
- data.tar.gz: e330593b6aae61ad7ed11e6c82a7e9be6b3292d25847e69eafef9218583eaec787b9127e15447f8ca5f0c3d628b459909b5eb46f5a9414ca13f8b7daf0a36acd
6
+ metadata.gz: 7670670156db2d4b8b538c52479cb4fc63a2a4f1f2191dc4944849dfd40249450c014d8026984408a0c6cebc13fcd3e0f5a978855edc4f0b30237c0fb9dfb543
7
+ data.tar.gz: f82b71d63638bbc6cd8b067bfdc955cb24ee39353746d283afab6591d1a3649e5091916bb3fe2caf92db21e11e5d5bc05ee17d2294194021c5a1eccada7f34c5
data/.rubocop_todo.yml CHANGED
@@ -70,3 +70,13 @@ Style/FrozenStringLiteralComment:
70
70
  Style/MixinUsage:
71
71
  Exclude:
72
72
  - 'lib/simple_symbolize.rb'
73
+
74
+ # Offense count: 2
75
+ Lint/BooleanSymbol:
76
+ Exclude:
77
+ - 'spec/simple_symbolize_spec.rb'
78
+
79
+ # Offense count: 2
80
+ Metrics/BlockLength:
81
+ Exclude:
82
+ - 'spec/simple_symbolize_spec.rb'
data/bin/console CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'bundler/setup'
4
4
  require 'simple_symbolize'
5
+ require 'pry'
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
7
8
  # with your gem easier. You can also use a different console, if you like.
@@ -1,3 +1,3 @@
1
1
  module SimpleSymbolize
2
- VERSION = '2.0.0'.freeze
2
+ VERSION = '2.0.2'.freeze
3
3
  end
@@ -31,7 +31,7 @@ module SimpleSymbolize
31
31
  def symbolize(str)
32
32
  return str if str.is_a?(Symbol) || str.nil?
33
33
 
34
- str.downcase.tr(SimpleSymbolize.translations.underscore.join, '_')
34
+ str.to_s.downcase.tr(SimpleSymbolize.translations.underscore.join, '_')
35
35
  &.tr(SimpleSymbolize.translations.remove.join, '')&.to_sym
36
36
  end
37
37
 
@@ -39,7 +39,7 @@ module SimpleSymbolize
39
39
  #
40
40
  # @param str [String] the String object to be symbolized.
41
41
  #
42
- # @example Symbolize a string using the camelize method
42
+ # @example Elementize a string using the elementize method
43
43
  # elementize("hello world!") #=> "helloWorld"
44
44
  def elementize(str)
45
45
  return str unless str.is_a?(Symbol) || str.is_a?(String)
@@ -55,9 +55,9 @@ module SimpleSymbolize
55
55
  # camelize("hello world!") #=> :helloWorld
56
56
  def camelize(str)
57
57
  return str unless str.is_a?(String) || str.is_a?(Symbol)
58
- return str.to_sym if str.is_a?(String) && (str.split(/[_ ]/).size <= 1)
58
+ return symbolize(str) if str.is_a?(String) && (str.split(/[_ ]/).size <= 1)
59
59
 
60
60
  first, *rest = elementize(str).split('_')
61
- rest ? (first << rest.map(&:capitalize).join).to_sym : first.to_sym
61
+ rest ? (first << rest.map(&:capitalize).join).to_sym : symbolize(first)
62
62
  end
63
63
  end
@@ -31,6 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
32
  spec.require_paths = ['lib']
33
33
 
34
+ spec.add_development_dependency 'pry', '~> 0.14'
34
35
  spec.add_development_dependency 'rake', '~> 12.0'
35
36
  spec.add_development_dependency 'rspec', '~> 3.2'
36
37
  spec.add_development_dependency 'rubocop', '~> 1.29.0'
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_symbolize
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - alexo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-20 00:00:00.000000000 Z
11
+ date: 2022-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pry
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.14'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.14'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rake
15
29
  requirement: !ruby/object:Gem::Requirement