simple_symbolize 2.0.2 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/.github/workflows/ruby_gem.yml +1 -1
- data/.rubocop.yml +31 -3
- data/.ruby-version +1 -0
- data/Gemfile +2 -0
- data/README.md +64 -17
- data/Rakefile +2 -0
- data/bin/console +1 -0
- data/lib/simple_symbolize/core_ext/string/symbolize.rb +36 -0
- data/lib/simple_symbolize/translations.rb +55 -30
- data/lib/simple_symbolize/version.rb +3 -1
- data/lib/simple_symbolize.rb +59 -23
- data/simple_symbolize.gemspec +8 -8
- metadata +26 -11
- data/.rubocop_todo.yml +0 -82
- data/lib/simple_symbolize/string.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69d7f99fc0ead5eeda918161fe2995fb4b58bcd39e297dae0af8d7efceb0b030
|
4
|
+
data.tar.gz: e5685b751c32abb542e6599f9677a785d7584be97d0c47a45067125192e0687e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 196774c36c21335f2699a7db17dbe10e7df3727533b9d53b401c852371d8347aaf900dbea9811e948b23d333b344d44b11bfff4dbce99888e0ac70557f67304d
|
7
|
+
data.tar.gz: c7e76fa9f182ad23ccef97ab8e47a40626316369dd2bf187609a292043c0f91a432455399d086b79eb61daf0aa2ba46accc23bab72946a7dd3b47de5d922400e
|
data/.github/workflows/ruby.yml
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,5 +1,33 @@
|
|
1
|
-
inherit_from: .rubocop_todo.yml
|
2
|
-
|
3
1
|
AllCops:
|
4
2
|
NewCops: enable
|
5
|
-
SuggestExtensions: false
|
3
|
+
SuggestExtensions: false
|
4
|
+
TargetRubyVersion: 3.0
|
5
|
+
|
6
|
+
Gemspec/DevelopmentDependencies:
|
7
|
+
EnforcedStyle: gemspec
|
8
|
+
|
9
|
+
Gemspec/RequireMFA:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
Metrics/BlockLength:
|
13
|
+
Max: 120
|
14
|
+
Exclude:
|
15
|
+
- spec/**/*.rb
|
16
|
+
|
17
|
+
Style/MixinUsage:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
Lint/BooleanSymbol:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
Metrics/AbcSize:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
Metrics/MethodLength:
|
27
|
+
Max: 25
|
28
|
+
|
29
|
+
Layout/LineLength:
|
30
|
+
Max: 130
|
31
|
+
|
32
|
+
Metrics/CyclomaticComplexity:
|
33
|
+
Max: 8
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.2.2
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -17,7 +17,7 @@ It works by removing special characters in a String like `'!'` and underscoring
|
|
17
17
|
'hello world!'.to_sym # => :"hello world!"
|
18
18
|
|
19
19
|
# Symbolize gem
|
20
|
-
'hello world!'.
|
20
|
+
'hello world!'.simple_symbolize # => :hello_world
|
21
21
|
```
|
22
22
|
|
23
23
|
## Installation
|
@@ -53,7 +53,9 @@ SimpleSymbolize.symbolize('hello world!') # => :hello_world
|
|
53
53
|
```ruby
|
54
54
|
require 'simple_symbolize'
|
55
55
|
|
56
|
-
|
56
|
+
String.include SimpleSymbolize::CoreExt::String
|
57
|
+
|
58
|
+
'hello world!'.simple_symbolize # => :hello_world
|
57
59
|
```
|
58
60
|
|
59
61
|
## Configuration
|
@@ -64,40 +66,85 @@ No sweat, you can configure this gem to underscore and remove to your hearts con
|
|
64
66
|
|
65
67
|
```ruby
|
66
68
|
SimpleSymbolize.translate do |trans|
|
67
|
-
trans.to_underscore
|
68
|
-
trans.to_remove
|
69
|
-
trans.to_omit
|
69
|
+
trans.to_underscore = '!'
|
70
|
+
trans.to_remove = ' '
|
71
|
+
trans.to_omit = '@'
|
70
72
|
end
|
71
73
|
```
|
72
74
|
|
73
75
|
## Updates!
|
74
76
|
|
75
|
-
|
77
|
+
### V4
|
78
|
+
#### String methods now need to be Mixed in
|
76
79
|
|
77
|
-
|
80
|
+
SimpleSymbolize is safe to use with other gems, particularly the popular ActiveSupport gem which SimpleSymbolize use to share
|
81
|
+
certain methods names with.
|
78
82
|
|
79
|
-
|
83
|
+
You now need to deliberatly mixin the methods on the String class:
|
80
84
|
|
81
|
-
|
82
|
-
|
85
|
+
```ruby
|
86
|
+
String.include SimpleSymbolize::CoreExt::String
|
87
|
+
```
|
83
88
|
|
84
|
-
|
89
|
+
To make them easier to spot, the method names on the String class have been prefixed with `simple_` to avoid confusion.
|
85
90
|
|
86
91
|
```ruby
|
87
|
-
|
92
|
+
'Hello World!'.simple_symbolize #=> :hello_world
|
93
|
+
'Hello World!'.simple_elementize #=> 'hello_world'
|
94
|
+
'Hello World!'.simple_camelize #=> :helloWorld
|
95
|
+
'Hello World!'.simple_snakeize #=> :hello_world
|
88
96
|
```
|
89
97
|
|
90
|
-
|
98
|
+
#### Introducing #snakeize
|
91
99
|
|
92
|
-
|
93
|
-
|
100
|
+
The `#snakeize` method will return your object in snake_case.
|
101
|
+
This is the default behaviour of the `#symbolize` method however `#snakeize` will always return thr Symbol in snake_case.
|
94
102
|
|
95
|
-
|
103
|
+
### V3
|
104
|
+
#### String to_snake_case [DEPRECATED - replaced with `#simple_snakeize` in v4]
|
105
|
+
|
106
|
+
`#to_snake_case` extends the String class to return you your String object in snake_case format.
|
107
|
+
|
108
|
+
#### Handle camelCase with Symbolize
|
109
|
+
|
110
|
+
```ruby
|
111
|
+
SimpleSymbolize.symbolize('helloWorld!') # => :hello_world
|
112
|
+
```
|
113
|
+
|
114
|
+
This is the default behaviour and can be switched off by setting `#handle_camel_case` to `false`
|
115
|
+
|
116
|
+
```ruby
|
117
|
+
SimpleSymbolize.translate { |trans| trans.handle_camel_case = false }
|
118
|
+
```
|
119
|
+
|
120
|
+
#### Additional ways to configure SimpleSymbolize
|
121
|
+
|
122
|
+
Arrays are now supported when configuring the gem
|
123
|
+
|
124
|
+
```ruby
|
125
|
+
SimpleSymbolize.translate { |trans| trans.to_underscore = %w[!&*] }
|
126
|
+
```
|
127
|
+
|
128
|
+
### V2
|
129
|
+
|
130
|
+
SimpleSymbolize has got new friends!
|
131
|
+
|
132
|
+
Introducing `elementize` and `camelize`.
|
133
|
+
|
134
|
+
#### Elementize
|
135
|
+
|
136
|
+
Sometimes you just want a simple String obj without all the fuss. Elementize takes your String obj, removes that fuss
|
137
|
+
and returns you a simple-to-use String.
|
96
138
|
|
97
139
|
```ruby
|
98
|
-
|
140
|
+
SimpleSymbolize.elementize('hello world!') # => "hello_world"
|
99
141
|
```
|
100
142
|
|
143
|
+
#### Camelize
|
144
|
+
|
145
|
+
Great for working with APIs that require fields in a JSON format. Camelize clears away the clutter and returns you
|
146
|
+
a Symbolized object in camelCase.
|
147
|
+
|
101
148
|
[comment]: <> (## Contributing)
|
102
149
|
|
103
150
|
[comment]: <> (Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/simple_symbolize.)
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Extends the String class by mixing in the symbolize module.
|
4
|
+
# @example Mixin the methods to the String class
|
5
|
+
# String.include SimpleSymbolize::CoreExt::String
|
6
|
+
|
7
|
+
module SimpleSymbolize
|
8
|
+
module CoreExt
|
9
|
+
# Contains methods to be mixed into the String class
|
10
|
+
module String
|
11
|
+
# @example Symbolize a string using the String object method
|
12
|
+
# "hello world!".symbolize #=> :hello_world
|
13
|
+
def simple_symbolize
|
14
|
+
SimpleSymbolize.symbolize(self)
|
15
|
+
end
|
16
|
+
|
17
|
+
# @example Turns a String into a camelCase Symbol
|
18
|
+
# "Hello World".simple_camelize => :helloWorld
|
19
|
+
def simple_camelize
|
20
|
+
SimpleSymbolize.camelize(self)
|
21
|
+
end
|
22
|
+
|
23
|
+
# @example Symbolizes a String then calls #to_s
|
24
|
+
# "helloWorld".simple_elementize => 'hello_word'
|
25
|
+
def simple_elementize
|
26
|
+
SimpleSymbolize.elementize(self)
|
27
|
+
end
|
28
|
+
|
29
|
+
# @example Turns a String into it's snake_case equivalent
|
30
|
+
# "helloWorld".simple_snakeize => 'hello_word'
|
31
|
+
def simple_snakeize
|
32
|
+
SimpleSymbolize.snakeize(self)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -1,68 +1,93 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SimpleSymbolize
|
2
4
|
# The translations class holds the attributes used to transform a String object.
|
3
5
|
# It also provides helper methods to manipulate those attributes.
|
4
6
|
class Translations
|
5
7
|
# @return [Array] the characters to be transformed into underscores.
|
6
|
-
|
8
|
+
attr_reader :underscore
|
7
9
|
# @return [Array] the characters to be removed from the String.
|
8
|
-
|
10
|
+
attr_reader :remove
|
9
11
|
# @return [Array] the characters to be untouched from the String.
|
10
|
-
|
12
|
+
attr_reader :omit
|
13
|
+
|
14
|
+
attr_reader :handle_camel_case
|
11
15
|
|
12
16
|
# Creates an instance of the Translations class.
|
13
17
|
#
|
14
18
|
# Sets the class variables to a default state.
|
15
19
|
def initialize
|
16
|
-
|
17
|
-
@remove = %w[\' ( ) , . : "]
|
18
|
-
@omit = []
|
20
|
+
reset!
|
19
21
|
end
|
20
22
|
|
21
23
|
# Merges the String passed with the @underscore Array omitting duplicates.
|
22
|
-
# Removes those characters from the @remove
|
24
|
+
# Removes those characters from the @remove and @omit Arrays to avoid the change being over-written.
|
23
25
|
#
|
24
|
-
# @param
|
26
|
+
# @param chars [Array] an object containing characters to be underscored.
|
25
27
|
#
|
26
28
|
# @return [Array] the Array of characters to be underscored.
|
27
|
-
|
28
|
-
|
29
|
-
def to_underscore(t)
|
30
|
-
raise ArgumentError 'needs to be a String or respond to #to_s' unless t.respond_to?(:to_s)
|
29
|
+
def to_underscore=(chars)
|
30
|
+
chars = sanitise_chars(chars)
|
31
31
|
|
32
|
-
@remove -=
|
33
|
-
@omit -=
|
34
|
-
@underscore |=
|
32
|
+
@remove -= chars
|
33
|
+
@omit -= chars
|
34
|
+
@underscore |= chars
|
35
35
|
end
|
36
36
|
|
37
37
|
# Merges the String passed with the @remove Array omitting duplicates.
|
38
38
|
# Removes those characters from the @underscore and @omit Arrays to avoid the change being over-written.
|
39
39
|
#
|
40
|
-
# @param
|
40
|
+
# @param chars [String] a String object containing characters to be removed.
|
41
41
|
#
|
42
42
|
# @return [Array] the Array of characters to be removed.
|
43
|
-
|
44
|
-
|
45
|
-
def to_remove(t)
|
46
|
-
raise ArgumentError 'needs to be a String or respond to #to_s' unless t.respond_to?(:to_s)
|
43
|
+
def to_remove=(chars)
|
44
|
+
chars = sanitise_chars(chars)
|
47
45
|
|
48
|
-
@underscore -=
|
49
|
-
@omit -=
|
50
|
-
@remove |=
|
46
|
+
@underscore -= chars
|
47
|
+
@omit -= chars
|
48
|
+
@remove |= chars
|
51
49
|
end
|
52
50
|
|
53
51
|
# Removes characters within the String passed from the @remove and @underscore Arrays.
|
54
52
|
#
|
55
|
-
# @param
|
53
|
+
# @param chars [String] a String object containing characters to be removed.
|
56
54
|
#
|
57
55
|
# @return [Array] the Array of characters to be omitted.
|
56
|
+
def to_omit=(chars)
|
57
|
+
chars = sanitise_chars(chars)
|
58
|
+
|
59
|
+
@underscore -= chars
|
60
|
+
@remove -= chars
|
61
|
+
@omit += chars
|
62
|
+
end
|
63
|
+
|
64
|
+
def handle_camel_case=(handle)
|
65
|
+
handle = handle.to_s.downcase
|
66
|
+
raise ArgumentError 'needs to be either `true` or `false`' unless %w[true false].include?(handle)
|
67
|
+
|
68
|
+
@handle_camel_case = handle.eql?('true')
|
69
|
+
end
|
70
|
+
|
71
|
+
def reset!
|
72
|
+
@underscore = [' ', '::', '-']
|
73
|
+
@remove = %w[' ( ) , . : " ! @ £ $ % ^ & * / { } [ ] < > ; = #]
|
74
|
+
@omit = []
|
75
|
+
@handle_camel_case = true
|
76
|
+
end
|
77
|
+
|
78
|
+
private
|
79
|
+
|
80
|
+
# Converts chars into Array of Strings
|
81
|
+
#
|
82
|
+
# @param arg Arg to be converted
|
83
|
+
#
|
84
|
+
# @return Array of Strings
|
58
85
|
#
|
59
|
-
# @raise [ArgumentError] if the
|
60
|
-
def
|
61
|
-
raise ArgumentError 'needs to be a String or
|
86
|
+
# @raise [ArgumentError] if the arg is not either a String or an Array.
|
87
|
+
def sanitise_chars(arg)
|
88
|
+
raise ArgumentError 'needs to be a String or an Array of characters' unless [String, Array].include?(arg.class)
|
62
89
|
|
63
|
-
|
64
|
-
@remove -= t.to_s.chars
|
65
|
-
@omit += t.to_s.chars
|
90
|
+
arg.respond_to?(:chars) ? arg.chars : arg.map(&:to_s)
|
66
91
|
end
|
67
92
|
end
|
68
93
|
end
|
data/lib/simple_symbolize.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'simple_symbolize/version'
|
2
4
|
|
3
|
-
require_relative 'simple_symbolize/string'
|
4
5
|
require_relative 'simple_symbolize/translations'
|
6
|
+
require_relative 'simple_symbolize/core_ext/string/symbolize'
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
+
# Main module for the gem
|
9
|
+
# Contains the base methods and allows configuration
|
8
10
|
module SimpleSymbolize
|
9
11
|
class Error < StandardError; end
|
10
12
|
|
@@ -18,46 +20,80 @@ module SimpleSymbolize
|
|
18
20
|
# Configures the Symbolize environment.
|
19
21
|
#
|
20
22
|
# @yieldparam [Translations] config the translations object yielded to the block.
|
21
|
-
def self.translate
|
22
|
-
yield
|
23
|
+
def self.translate
|
24
|
+
yield(translations) if block_given?
|
23
25
|
end
|
24
26
|
|
25
27
|
# Symbolizes a String object.
|
26
28
|
#
|
27
|
-
# @param
|
29
|
+
# @param obj [Object] the String object to be symbolized.
|
28
30
|
#
|
29
31
|
# @example Symbolize a string using the symbolize method
|
30
|
-
# symbolize("hello world!") #=> :hello_world
|
31
|
-
def symbolize(
|
32
|
-
return
|
32
|
+
# SimpleSymbolize.symbolize("hello world!") #=> :hello_world
|
33
|
+
def self.symbolize(obj)
|
34
|
+
return obj unless obj.respond_to?(:to_s)
|
35
|
+
return obj if [Hash, Array, NilClass].include?(obj.class)
|
36
|
+
return obj if obj.respond_to?(:empty?) && obj.empty?
|
33
37
|
|
34
|
-
|
35
|
-
|
38
|
+
obj = if SimpleSymbolize.translations.handle_camel_case
|
39
|
+
snakeize(obj)
|
40
|
+
else
|
41
|
+
obj.to_s
|
42
|
+
.downcase
|
43
|
+
.gsub(Regexp.union(SimpleSymbolize.translations.underscore), '_')
|
44
|
+
.gsub(Regexp.union(SimpleSymbolize.translations.remove), '')
|
45
|
+
end
|
46
|
+
obj.to_sym
|
36
47
|
end
|
37
48
|
|
38
49
|
# Symbolizes a String object and returns it as a String object.
|
39
50
|
#
|
40
|
-
# @param
|
51
|
+
# @param obj [Object] the object to be symbolized.
|
41
52
|
#
|
42
53
|
# @example Elementize a string using the elementize method
|
43
|
-
# elementize("hello world!") #=> "helloWorld"
|
44
|
-
def elementize(
|
45
|
-
return
|
54
|
+
# SimpleSymbolize.elementize("hello world!") #=> "helloWorld"
|
55
|
+
def self.elementize(obj)
|
56
|
+
return obj unless obj.respond_to?(:to_s)
|
57
|
+
return obj if [Hash, Array, NilClass].include?(obj.class)
|
58
|
+
return obj if obj.respond_to?(:empty?) && obj.empty?
|
46
59
|
|
47
|
-
symbolize(
|
60
|
+
symbolize(obj).to_s
|
48
61
|
end
|
49
62
|
|
50
63
|
# Turns a String object into a camelCase Symbol.
|
51
64
|
#
|
52
|
-
# @param
|
65
|
+
# @param obj [Object] the String object to be camelized.
|
53
66
|
#
|
54
67
|
# @example Camelize a string using the camelize method
|
55
|
-
# camelize("hello world!") #=> :helloWorld
|
56
|
-
def camelize(
|
57
|
-
return
|
58
|
-
return
|
68
|
+
# SimpleSymbolize.camelize("hello world!") #=> :helloWorld
|
69
|
+
def self.camelize(obj)
|
70
|
+
return obj unless obj.respond_to?(:to_s)
|
71
|
+
return obj if [Hash, Array, NilClass].include?(obj.class)
|
72
|
+
return obj if obj.respond_to?(:empty?) && obj.empty?
|
73
|
+
|
74
|
+
first, *rest = elementize(obj).split('_')
|
75
|
+
return obj if first.nil?
|
76
|
+
|
77
|
+
rest.size.positive? ? (first << rest.map(&:capitalize).join).to_sym : symbolize(first)
|
78
|
+
end
|
79
|
+
|
80
|
+
# Turns a String || Symbol into a snake_case Symbol
|
81
|
+
#
|
82
|
+
# @param obj [Object] the object to be snakeize
|
83
|
+
#
|
84
|
+
# @example Snakeize an object using the snakeize method
|
85
|
+
# SimpleSymbolize.snakeize('Hello World!') #=> :hello_world
|
86
|
+
def self.snakeize(obj)
|
87
|
+
return obj unless obj.respond_to?(:to_s)
|
88
|
+
return obj if [Hash, Array, NilClass].include?(obj.class)
|
89
|
+
return obj if obj.respond_to?(:empty?) && obj.empty?
|
59
90
|
|
60
|
-
|
61
|
-
|
91
|
+
obj.to_s
|
92
|
+
.gsub(Regexp.union(SimpleSymbolize.translations.underscore), '_')
|
93
|
+
.gsub(Regexp.union(SimpleSymbolize.translations.remove), '')
|
94
|
+
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
95
|
+
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
96
|
+
.downcase
|
97
|
+
.to_sym
|
62
98
|
end
|
63
99
|
end
|
data/simple_symbolize.gemspec
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'lib/simple_symbolize/version'
|
2
4
|
|
3
5
|
Gem::Specification.new do |spec|
|
4
6
|
spec.name = 'simple_symbolize'
|
5
7
|
spec.version = SimpleSymbolize::VERSION
|
6
|
-
spec.authors = ['alexo']
|
8
|
+
spec.authors = ['alexo', 'Driver and Vehicle Licensing Agency (DVLA)']
|
7
9
|
spec.email = ['']
|
8
10
|
|
9
11
|
spec.summary = 'Turns Strings into Symbols.'
|
@@ -14,13 +16,10 @@ Gem::Specification.new do |spec|
|
|
14
16
|
spec.homepage = 'https://github.com/dvla/simple-symbolize'
|
15
17
|
|
16
18
|
spec.license = 'MIT'
|
17
|
-
spec.required_ruby_version = Gem::Requirement.new('>=
|
18
|
-
|
19
|
-
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
19
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 3.0')
|
20
20
|
|
21
21
|
spec.metadata['homepage_uri'] = spec.homepage
|
22
22
|
spec.metadata['source_code_uri'] = spec.homepage
|
23
|
-
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
24
23
|
|
25
24
|
# Specify which files should be added to the gem when it is released.
|
26
25
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -32,7 +31,8 @@ Gem::Specification.new do |spec|
|
|
32
31
|
spec.require_paths = ['lib']
|
33
32
|
|
34
33
|
spec.add_development_dependency 'pry', '~> 0.14'
|
35
|
-
spec.add_development_dependency 'rake', '~>
|
36
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
37
|
-
spec.add_development_dependency 'rubocop', '~> 1.
|
34
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
35
|
+
spec.add_development_dependency 'rspec', '~> 3.12'
|
36
|
+
spec.add_development_dependency 'rubocop', '~> 1.54'
|
37
|
+
spec.add_development_dependency 'simplecov', '~> 0.22'
|
38
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_symbolize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alexo
|
8
|
+
- Driver and Vehicle Licensing Agency (DVLA)
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2024-01-12 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: pry
|
@@ -30,42 +31,56 @@ dependencies:
|
|
30
31
|
requirements:
|
31
32
|
- - "~>"
|
32
33
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
34
|
+
version: '13.0'
|
34
35
|
type: :development
|
35
36
|
prerelease: false
|
36
37
|
version_requirements: !ruby/object:Gem::Requirement
|
37
38
|
requirements:
|
38
39
|
- - "~>"
|
39
40
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
41
|
+
version: '13.0'
|
41
42
|
- !ruby/object:Gem::Dependency
|
42
43
|
name: rspec
|
43
44
|
requirement: !ruby/object:Gem::Requirement
|
44
45
|
requirements:
|
45
46
|
- - "~>"
|
46
47
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
48
|
+
version: '3.12'
|
48
49
|
type: :development
|
49
50
|
prerelease: false
|
50
51
|
version_requirements: !ruby/object:Gem::Requirement
|
51
52
|
requirements:
|
52
53
|
- - "~>"
|
53
54
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
55
|
+
version: '3.12'
|
55
56
|
- !ruby/object:Gem::Dependency
|
56
57
|
name: rubocop
|
57
58
|
requirement: !ruby/object:Gem::Requirement
|
58
59
|
requirements:
|
59
60
|
- - "~>"
|
60
61
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
62
|
+
version: '1.54'
|
62
63
|
type: :development
|
63
64
|
prerelease: false
|
64
65
|
version_requirements: !ruby/object:Gem::Requirement
|
65
66
|
requirements:
|
66
67
|
- - "~>"
|
67
68
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
69
|
+
version: '1.54'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: simplecov
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0.22'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0.22'
|
69
84
|
description: 'simple_symbolize will remove special characters from a String, replacing
|
70
85
|
whitespace with an underscore, down-casing and finally calling the #to_sym String
|
71
86
|
method. Configure this gem to your hearts content!'
|
@@ -80,7 +95,7 @@ files:
|
|
80
95
|
- ".gitignore"
|
81
96
|
- ".rspec"
|
82
97
|
- ".rubocop.yml"
|
83
|
-
- ".
|
98
|
+
- ".ruby-version"
|
84
99
|
- Gemfile
|
85
100
|
- LICENSE.txt
|
86
101
|
- README.md
|
@@ -88,7 +103,7 @@ files:
|
|
88
103
|
- bin/console
|
89
104
|
- bin/setup
|
90
105
|
- lib/simple_symbolize.rb
|
91
|
-
- lib/simple_symbolize/string.rb
|
106
|
+
- lib/simple_symbolize/core_ext/string/symbolize.rb
|
92
107
|
- lib/simple_symbolize/translations.rb
|
93
108
|
- lib/simple_symbolize/version.rb
|
94
109
|
- simple_symbolize.gemspec
|
@@ -106,7 +121,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
106
121
|
requirements:
|
107
122
|
- - ">="
|
108
123
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
124
|
+
version: '3.0'
|
110
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
126
|
requirements:
|
112
127
|
- - ">="
|
data/.rubocop_todo.yml
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
# on 2022-05-20 09:59:54 UTC using RuboCop version 1.29.1.
|
4
|
-
# The point is for the user to remove these configuration records
|
5
|
-
# one by one as the offenses are removed from the code base.
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
8
|
-
|
9
|
-
# Offense count: 1
|
10
|
-
# This cop supports safe auto-correction (--auto-correct).
|
11
|
-
# Configuration parameters: Include.
|
12
|
-
# Include: **/*.gemspec
|
13
|
-
Gemspec/RequireMFA:
|
14
|
-
Exclude:
|
15
|
-
- 'simple_symbolize.gemspec'
|
16
|
-
|
17
|
-
# Offense count: 1
|
18
|
-
# Configuration parameters: Include.
|
19
|
-
# Include: **/*.gemspec
|
20
|
-
Gemspec/RequiredRubyVersion:
|
21
|
-
Exclude:
|
22
|
-
- 'simple_symbolize.gemspec'
|
23
|
-
|
24
|
-
# Offense count: 1
|
25
|
-
# This cop supports safe auto-correction (--auto-correct).
|
26
|
-
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
|
27
|
-
Lint/UnusedMethodArgument:
|
28
|
-
Exclude:
|
29
|
-
- 'lib/simple_symbolize.rb'
|
30
|
-
|
31
|
-
# Offense count: 1
|
32
|
-
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
33
|
-
# IgnoredMethods: refine
|
34
|
-
Metrics/BlockLength:
|
35
|
-
Max: 88
|
36
|
-
|
37
|
-
# Offense count: 3
|
38
|
-
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
39
|
-
# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
|
40
|
-
Naming/MethodParameterName:
|
41
|
-
Exclude:
|
42
|
-
- 'lib/simple_symbolize/translations.rb'
|
43
|
-
|
44
|
-
# Offense count: 1
|
45
|
-
# Configuration parameters: AllowedConstants.
|
46
|
-
Style/Documentation:
|
47
|
-
Exclude:
|
48
|
-
- 'spec/**/*'
|
49
|
-
- 'test/**/*'
|
50
|
-
- 'lib/simple_symbolize.rb'
|
51
|
-
|
52
|
-
# Offense count: 10
|
53
|
-
# This cop supports safe auto-correction (--auto-correct).
|
54
|
-
# Configuration parameters: EnforcedStyle.
|
55
|
-
# SupportedStyles: always, always_true, never
|
56
|
-
Style/FrozenStringLiteralComment:
|
57
|
-
Exclude:
|
58
|
-
- 'Gemfile'
|
59
|
-
- 'Rakefile'
|
60
|
-
- 'bin/console'
|
61
|
-
- 'lib/simple_symbolize.rb'
|
62
|
-
- 'lib/simple_symbolize/string.rb'
|
63
|
-
- 'lib/simple_symbolize/translations.rb'
|
64
|
-
- 'lib/simple_symbolize/version.rb'
|
65
|
-
- 'simple_symbolize.gemspec'
|
66
|
-
- 'spec/simple_symbolize_spec.rb'
|
67
|
-
- 'spec/spec_helper.rb'
|
68
|
-
|
69
|
-
# Offense count: 1
|
70
|
-
Style/MixinUsage:
|
71
|
-
Exclude:
|
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'
|
@@ -1,10 +0,0 @@
|
|
1
|
-
require 'simple_symbolize'
|
2
|
-
|
3
|
-
# Extends the String class by mixing in the symbolize module.
|
4
|
-
class String
|
5
|
-
# @example Symbolize a string using the String object method
|
6
|
-
# "hello world!".symbolize #=> :hello_world
|
7
|
-
def symbolize
|
8
|
-
SimpleSymbolize.symbolize(self)
|
9
|
-
end
|
10
|
-
end
|