simple_symbolize 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/console +1 -0
- data/lib/simple_symbolize/version.rb +1 -1
- data/lib/simple_symbolize.rb +3 -3
- data/simple_symbolize.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59e6e0627c56ba92e83ade0f7da175a6900efb94239e7d090cf3021ceecc2c36
|
4
|
+
data.tar.gz: c38a440d4feca6c293e39ddd44241f78c1b0096933a60d0929abb254ffe77497
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6242fbdc38514b7eed4b3931eb5391abc5e7d6b833ccb8bd5dc982c4eb301b4606b256139233ab5f07efec72de2f6fc8964cc38a99a33d4ddd5e734f77382c1e
|
7
|
+
data.tar.gz: bf26933555776d4b25f32c3bc2df40e385ad38f45c599b2129a981aae677f38156dbbec63351968e217478c4ea600063a08c02fe6c83320764afa49ef19cdbdc
|
data/bin/console
CHANGED
data/lib/simple_symbolize.rb
CHANGED
@@ -39,7 +39,7 @@ module SimpleSymbolize
|
|
39
39
|
#
|
40
40
|
# @param str [String] the String object to be symbolized.
|
41
41
|
#
|
42
|
-
# @example
|
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
|
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
|
61
|
+
rest ? (first << rest.map(&:capitalize).join).to_sym : symbolize(first)
|
62
62
|
end
|
63
63
|
end
|
data/simple_symbolize.gemspec
CHANGED
@@ -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.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alexo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-02 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
|