lite-ruby 1.0.22 → 1.0.27
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/.rubocop.yml +16 -0
- data/CHANGELOG.md +25 -0
- data/Gemfile.lock +28 -25
- data/docs/ARRAY.md +41 -5
- data/docs/HASH.md +20 -1
- data/docs/OBJECT.md +10 -0
- data/docs/OPEN_STRUCT.md +23 -1
- data/lib/lite/ruby/array.rb +35 -1
- data/lib/lite/ruby/hash.rb +11 -0
- data/lib/lite/ruby/object.rb +4 -0
- data/lib/lite/ruby/open_struct.rb +15 -1
- data/lib/lite/ruby/string.rb +3 -3
- data/lib/lite/ruby/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfc486f31bfbbad993a40604cf0334d8f59b5956cf6020f52c5c7140d4e8f114
|
4
|
+
data.tar.gz: 3b4b5b748b28261e8e602c78cb11e91b546b0c03905c07ac6045a4903f295992
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9262f97caffc9c198d750cafa76354501df7ef960e6054c8e236a769c9ac26e07a48ee22f68f4e834b9400533f28d35c865f038aa7af0404c8e671735a2baf6
|
7
|
+
data.tar.gz: fb8058ad49733add958510930473bd26d597432e4aae95c15a77c9aff63847a462cb0fd7d1cfda3a96afb98465c8bc9107c89ba73149482565f836d06e0529ae
|
data/.rubocop.yml
CHANGED
@@ -8,12 +8,20 @@ AllCops:
|
|
8
8
|
Layout/EmptyLinesAroundBlockBody:
|
9
9
|
Exclude:
|
10
10
|
- 'spec/**/**/*'
|
11
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
12
|
+
Enabled: true
|
11
13
|
Layout/EmptyLinesAroundClassBody:
|
12
14
|
EnforcedStyle: empty_lines_except_namespace
|
13
15
|
Layout/EmptyLinesAroundModuleBody:
|
14
16
|
EnforcedStyle: empty_lines_except_namespace
|
15
17
|
Layout/LineLength:
|
16
18
|
Max: 100
|
19
|
+
Layout/SpaceAroundMethodCallOperator:
|
20
|
+
Enabled: true
|
21
|
+
Lint/DeprecatedOpenSSLConstant:
|
22
|
+
Enabled: true
|
23
|
+
Lint/MixedRegexpCaptureTypes:
|
24
|
+
Enabled: true
|
17
25
|
Lint/RaiseException:
|
18
26
|
Enabled: true
|
19
27
|
Lint/StructNewOverride:
|
@@ -37,6 +45,8 @@ Style/Documentation:
|
|
37
45
|
Enabled: false
|
38
46
|
Style/ExpandPathArguments:
|
39
47
|
Enabled: false
|
48
|
+
Style/ExponentialNotation:
|
49
|
+
Enabled: true
|
40
50
|
Style/HashEachMethods:
|
41
51
|
Enabled: true
|
42
52
|
Style/HashTransformKeys:
|
@@ -45,3 +55,9 @@ Style/HashTransformValues:
|
|
45
55
|
Enabled: false
|
46
56
|
Style/PerlBackrefs:
|
47
57
|
Enabled: false
|
58
|
+
Style/RedundantRegexpCharacterClass:
|
59
|
+
Enabled: true
|
60
|
+
Style/RedundantRegexpEscape:
|
61
|
+
Enabled: true
|
62
|
+
Style/SlicingWithRange:
|
63
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [1.0.26] - 2020-06-12
|
10
|
+
### Added
|
11
|
+
- Added array => `all_after`
|
12
|
+
- Added array => `all_before`
|
13
|
+
|
14
|
+
## [1.0.26] - 2020-05-22
|
15
|
+
### Changed
|
16
|
+
- Changed hash `to_open_struct` and `to_object` to be independent methods
|
17
|
+
|
18
|
+
## [1.0.25] - 2020-05-20
|
19
|
+
### Added
|
20
|
+
- Added Hash => `to_open_struct`
|
21
|
+
- Added Hash => `to_struct`
|
22
|
+
- Added OpenStruct => `to_hash`
|
23
|
+
- Added OpenStruct => `to_json(table: true)`
|
24
|
+
|
25
|
+
## [1.0.24] - 2020-05-07
|
26
|
+
### Added
|
27
|
+
- Added Object => `salvage_try`
|
28
|
+
|
29
|
+
## [1.0.23] - 2020-05-03
|
30
|
+
### Added
|
31
|
+
- Added Array => `except`
|
32
|
+
- Added Array => `only`
|
33
|
+
|
9
34
|
## [1.0.22] - 2020-04-11
|
10
35
|
### Fixed
|
11
36
|
- Fixed reverse_merge! on a frozen hash
|
data/Gemfile.lock
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lite-ruby (1.0.
|
4
|
+
lite-ruby (1.0.27)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
actionpack (6.0.
|
10
|
-
actionview (= 6.0.
|
11
|
-
activesupport (= 6.0.
|
9
|
+
actionpack (6.0.3.1)
|
10
|
+
actionview (= 6.0.3.1)
|
11
|
+
activesupport (= 6.0.3.1)
|
12
12
|
rack (~> 2.0, >= 2.0.8)
|
13
13
|
rack-test (>= 0.6.3)
|
14
14
|
rails-dom-testing (~> 2.0)
|
15
15
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
16
|
-
actionview (6.0.
|
17
|
-
activesupport (= 6.0.
|
16
|
+
actionview (6.0.3.1)
|
17
|
+
activesupport (= 6.0.3.1)
|
18
18
|
builder (~> 3.1)
|
19
19
|
erubi (~> 1.4)
|
20
20
|
rails-dom-testing (~> 2.0)
|
21
21
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
22
|
-
activesupport (6.0.
|
22
|
+
activesupport (6.0.3.1)
|
23
23
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
24
24
|
i18n (>= 0.7, < 2)
|
25
25
|
minitest (~> 5.1)
|
26
26
|
tzinfo (~> 1.1)
|
27
|
-
zeitwerk (~> 2.2)
|
28
|
-
ast (2.4.
|
27
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
28
|
+
ast (2.4.1)
|
29
29
|
builder (3.2.4)
|
30
30
|
colorize (0.8.1)
|
31
31
|
concurrent-ruby (1.1.6)
|
@@ -38,19 +38,18 @@ GEM
|
|
38
38
|
generator_spec (0.9.4)
|
39
39
|
activesupport (>= 3.0.0)
|
40
40
|
railties (>= 3.0.0)
|
41
|
-
i18n (1.8.
|
41
|
+
i18n (1.8.3)
|
42
42
|
concurrent-ruby (~> 1.0)
|
43
|
-
jaro_winkler (1.5.4)
|
44
43
|
loofah (2.5.0)
|
45
44
|
crass (~> 1.0.2)
|
46
45
|
nokogiri (>= 1.5.9)
|
47
46
|
method_source (1.0.0)
|
48
47
|
mini_portile2 (2.4.0)
|
49
|
-
minitest (5.14.
|
48
|
+
minitest (5.14.1)
|
50
49
|
nokogiri (1.10.9)
|
51
50
|
mini_portile2 (~> 2.4.0)
|
52
51
|
parallel (1.19.1)
|
53
|
-
parser (2.7.1.
|
52
|
+
parser (2.7.1.3)
|
54
53
|
ast (~> 2.4.0)
|
55
54
|
rack (2.2.2)
|
56
55
|
rack-test (1.1.0)
|
@@ -60,44 +59,48 @@ GEM
|
|
60
59
|
nokogiri (>= 1.6)
|
61
60
|
rails-html-sanitizer (1.3.0)
|
62
61
|
loofah (~> 2.3)
|
63
|
-
railties (6.0.
|
64
|
-
actionpack (= 6.0.
|
65
|
-
activesupport (= 6.0.
|
62
|
+
railties (6.0.3.1)
|
63
|
+
actionpack (= 6.0.3.1)
|
64
|
+
activesupport (= 6.0.3.1)
|
66
65
|
method_source
|
67
66
|
rake (>= 0.8.7)
|
68
67
|
thor (>= 0.20.3, < 2.0)
|
69
68
|
rainbow (3.0.0)
|
70
69
|
rake (13.0.1)
|
70
|
+
regexp_parser (1.7.1)
|
71
71
|
rexml (3.2.4)
|
72
72
|
rspec (3.9.0)
|
73
73
|
rspec-core (~> 3.9.0)
|
74
74
|
rspec-expectations (~> 3.9.0)
|
75
75
|
rspec-mocks (~> 3.9.0)
|
76
|
-
rspec-core (3.9.
|
77
|
-
rspec-support (~> 3.9.
|
78
|
-
rspec-expectations (3.9.
|
76
|
+
rspec-core (3.9.2)
|
77
|
+
rspec-support (~> 3.9.3)
|
78
|
+
rspec-expectations (3.9.2)
|
79
79
|
diff-lcs (>= 1.2.0, < 2.0)
|
80
80
|
rspec-support (~> 3.9.0)
|
81
81
|
rspec-mocks (3.9.1)
|
82
82
|
diff-lcs (>= 1.2.0, < 2.0)
|
83
83
|
rspec-support (~> 3.9.0)
|
84
|
-
rspec-support (3.9.
|
85
|
-
rubocop (0.
|
86
|
-
jaro_winkler (~> 1.5.1)
|
84
|
+
rspec-support (3.9.3)
|
85
|
+
rubocop (0.85.1)
|
87
86
|
parallel (~> 1.10)
|
88
87
|
parser (>= 2.7.0.1)
|
89
88
|
rainbow (>= 2.2.2, < 4.0)
|
89
|
+
regexp_parser (>= 1.7)
|
90
90
|
rexml
|
91
|
+
rubocop-ast (>= 0.0.3)
|
91
92
|
ruby-progressbar (~> 1.7)
|
92
93
|
unicode-display_width (>= 1.4.0, < 2.0)
|
93
|
-
rubocop-
|
94
|
+
rubocop-ast (0.0.3)
|
95
|
+
parser (>= 2.7.0.1)
|
96
|
+
rubocop-performance (1.6.1)
|
94
97
|
rubocop (>= 0.71.0)
|
95
|
-
rubocop-rspec (1.
|
98
|
+
rubocop-rspec (1.40.0)
|
96
99
|
rubocop (>= 0.68.1)
|
97
100
|
ruby-progressbar (1.10.1)
|
98
101
|
ruby_parser (3.14.2)
|
99
102
|
sexp_processor (~> 4.9)
|
100
|
-
sexp_processor (4.
|
103
|
+
sexp_processor (4.15.0)
|
101
104
|
thor (1.0.1)
|
102
105
|
thread_safe (0.3.6)
|
103
106
|
tzinfo (1.2.7)
|
data/docs/ARRAY.md
CHANGED
@@ -64,14 +64,24 @@ Returns the value after a given value.
|
|
64
64
|
['1', '2', '3'].after('4') #=> nil
|
65
65
|
```
|
66
66
|
|
67
|
-
`
|
67
|
+
`all_after`
|
68
68
|
------
|
69
|
-
|
69
|
+
Returns all values after a given value.
|
70
70
|
|
71
71
|
```ruby
|
72
|
-
['1',
|
73
|
-
['1',
|
74
|
-
['1',
|
72
|
+
['1', '2', '3'].all_after('1') #=> [2, 3]
|
73
|
+
['1', '2', '3'].all_after('3') #=> nil
|
74
|
+
['1', '2', '3'].all_after('4') #=> nil
|
75
|
+
```
|
76
|
+
|
77
|
+
`all_before`
|
78
|
+
------
|
79
|
+
Returns all values before a given value.
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
['1', '2', '3'].all_before('3') #=> [1, 2]
|
83
|
+
['1', '2', '3'].all_before('1') #=> nil
|
84
|
+
['1', '2', '3'].all_before('4') #=> nil
|
75
85
|
```
|
76
86
|
|
77
87
|
`before`
|
@@ -84,6 +94,16 @@ Returns the value before a given value.
|
|
84
94
|
['1', '2', '3'].before('4') #=> nil
|
85
95
|
```
|
86
96
|
|
97
|
+
`bury`
|
98
|
+
------
|
99
|
+
Updates a deeply nested value.
|
100
|
+
|
101
|
+
```ruby
|
102
|
+
['1', ['2']].bury(1, '3') #=> ['1', '3']
|
103
|
+
['1', ['2']].bury(1, 0, '3') #=> ['1', ['3']]
|
104
|
+
['1', ['2']].bury(1) #=> raises ArgumentError: '2 or more arguments required'
|
105
|
+
```
|
106
|
+
|
87
107
|
`delete_first(!)`
|
88
108
|
------
|
89
109
|
Removes the first element from an array. Like `shift`, but returns the array instead of the removed element.
|
@@ -135,6 +155,14 @@ Returns a list of duplicate elements.
|
|
135
155
|
[1, 1, 2, 2, 2, 3].duplicates(3) #=> [2]
|
136
156
|
```
|
137
157
|
|
158
|
+
`except(!)`
|
159
|
+
------
|
160
|
+
Removes given values from the array.
|
161
|
+
|
162
|
+
```ruby
|
163
|
+
[1, 2, 3, 4].except(1, 3) #=> [2, 4]
|
164
|
+
```
|
165
|
+
|
138
166
|
`from`
|
139
167
|
------
|
140
168
|
Returns the tail of the array from a given position.
|
@@ -207,6 +235,14 @@ Converts blank values into `nil`.
|
|
207
235
|
['', 3, 4].nillify! #=> [nil, 3, 4]
|
208
236
|
```
|
209
237
|
|
238
|
+
`only(!)`
|
239
|
+
------
|
240
|
+
Selects given values from the array.
|
241
|
+
|
242
|
+
```ruby
|
243
|
+
[1, 2, 3, 4].only(1, 3) #=> [1, 3]
|
244
|
+
```
|
245
|
+
|
210
246
|
`probability`
|
211
247
|
------
|
212
248
|
Generates a hash mapping each unique element in the array to the relative frequency, i.e. the probability, of it appearance.
|
data/docs/HASH.md
CHANGED
@@ -427,10 +427,29 @@ Symbolize and underscore hash keys.
|
|
427
427
|
|
428
428
|
`to_object` aka `to_o`
|
429
429
|
------
|
430
|
-
Converts
|
430
|
+
Converts a hash and all nested hashes to open structs.
|
431
431
|
|
432
432
|
```ruby
|
433
433
|
{ foo: { bar: true } }.to_object.foo.bar #=> true
|
434
|
+
{ foo: { bar: true } }.to_object.foo.bax #=> nil
|
435
|
+
```
|
436
|
+
|
437
|
+
`to_open_struct`
|
438
|
+
------
|
439
|
+
Converts a hash to an open struct to have an object like API.
|
440
|
+
|
441
|
+
```ruby
|
442
|
+
{ foo: { bar: true } }.to_open_struct.foo #=> { bar: true }
|
443
|
+
{ foo: { bar: true } }.to_open_struct.bax #=> nil
|
444
|
+
```
|
445
|
+
|
446
|
+
`to_struct`
|
447
|
+
------
|
448
|
+
Converts a hash to a struct to have an object like API.
|
449
|
+
|
450
|
+
```ruby
|
451
|
+
{ foo: { bar: true } }.to_struct.foo #=> { bar: true }
|
452
|
+
{ foo: { bar: true } }.to_struct.bax #=> Raises error
|
434
453
|
```
|
435
454
|
|
436
455
|
`update_each`
|
data/docs/OBJECT.md
CHANGED
@@ -210,6 +210,16 @@ nil.salvage('bar') #=> 'bar'
|
|
210
210
|
123.salvage #=> 123
|
211
211
|
```
|
212
212
|
|
213
|
+
`salvage_try`
|
214
|
+
------
|
215
|
+
Similar to the try method but returns a placeholder instead of `nil`.
|
216
|
+
|
217
|
+
```ruby
|
218
|
+
'example'.salvage_try(:upcase) #=> 'EXAMPLE'
|
219
|
+
'example'.salvage_try(:fake_method) #=> '---'
|
220
|
+
'example'.salvage_try(:fake_method, placeholder: 'X') #=> 'X'
|
221
|
+
```
|
222
|
+
|
213
223
|
`send_chain`
|
214
224
|
------
|
215
225
|
Chains multiple callers to an object.
|
data/docs/OPEN_STRUCT.md
CHANGED
@@ -31,7 +31,7 @@ person['name'] = 'tim'
|
|
31
31
|
|
32
32
|
`attributes`
|
33
33
|
------
|
34
|
-
Returns the key values of the assigned struct.
|
34
|
+
Returns the key values as a hash of the assigned struct.
|
35
35
|
|
36
36
|
```ruby
|
37
37
|
person = OpenStruct.new(name: 'bob', age: 60)
|
@@ -49,3 +49,25 @@ person = OpenStruct.new(name: 'bob', age: 60)
|
|
49
49
|
person.replace(name: 'tom', age: 28)
|
50
50
|
preson.name #=> 'tom'
|
51
51
|
```
|
52
|
+
|
53
|
+
`to_hash` aka `to_h`
|
54
|
+
------
|
55
|
+
Returns the key values as a hash of the assigned struct.
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
person = OpenStruct.new(name: 'bob', age: 60)
|
59
|
+
|
60
|
+
person.to_hash #=> { table: { name: 'bob', age: 60 } }
|
61
|
+
person.to_hash(table: false) #=> { name: 'bob', age: 60 }
|
62
|
+
```
|
63
|
+
|
64
|
+
`to_json` aka `as_json`
|
65
|
+
------
|
66
|
+
Returns the key values as Json of the assigned struct.
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
person = OpenStruct.new(name: 'bob', age: 60)
|
70
|
+
|
71
|
+
person.to_json #=> { table: { name: 'bob', age: 60 } }
|
72
|
+
person.to_json(table: false) #=> { name: 'bob', age: 60 }
|
73
|
+
```
|
data/lib/lite/ruby/array.rb
CHANGED
@@ -59,6 +59,24 @@ if Lite::Ruby.configuration.monkey_patches.include?('array')
|
|
59
59
|
self[(index(value) + 1) % size]
|
60
60
|
end
|
61
61
|
|
62
|
+
def all_after(value)
|
63
|
+
return unless include?(value)
|
64
|
+
|
65
|
+
i = index(value)
|
66
|
+
return if i == (size - 1)
|
67
|
+
|
68
|
+
self[(i + 1)..-1]
|
69
|
+
end
|
70
|
+
|
71
|
+
def all_before(value)
|
72
|
+
return unless include?(value)
|
73
|
+
|
74
|
+
i = index(value)
|
75
|
+
return if i.zero?
|
76
|
+
|
77
|
+
self[0..(i - 1)]
|
78
|
+
end
|
79
|
+
|
62
80
|
def before(value)
|
63
81
|
return unless include?(value)
|
64
82
|
|
@@ -137,6 +155,14 @@ if Lite::Ruby.configuration.monkey_patches.include?('array')
|
|
137
155
|
hash.delete_if { |_, val| val < minimum }.keys
|
138
156
|
end
|
139
157
|
|
158
|
+
def except(*values)
|
159
|
+
reject { |val| values.include?(val) }
|
160
|
+
end
|
161
|
+
|
162
|
+
def except!(*values)
|
163
|
+
replace(except(*values))
|
164
|
+
end
|
165
|
+
|
140
166
|
def from(position)
|
141
167
|
self[position, size] || []
|
142
168
|
end
|
@@ -221,6 +247,14 @@ if Lite::Ruby.configuration.monkey_patches.include?('array')
|
|
221
247
|
replace(nillify)
|
222
248
|
end
|
223
249
|
|
250
|
+
def only(*values)
|
251
|
+
select { |val| values.include?(val) }
|
252
|
+
end
|
253
|
+
|
254
|
+
def only!(*values)
|
255
|
+
replace(only(*values))
|
256
|
+
end
|
257
|
+
|
224
258
|
def position(value)
|
225
259
|
idx = index(value)
|
226
260
|
return idx if idx.nil?
|
@@ -278,7 +312,7 @@ if Lite::Ruby.configuration.monkey_patches.include?('array')
|
|
278
312
|
array = [[]]
|
279
313
|
|
280
314
|
if block_given?
|
281
|
-
each { |val| yield(val) ? (array << []) : (array
|
315
|
+
each { |val| yield(val) ? (array << []) : (array.last << val) }
|
282
316
|
else
|
283
317
|
dup_arr = dup
|
284
318
|
|
data/lib/lite/ruby/hash.rb
CHANGED
@@ -446,6 +446,17 @@ if Lite::Ruby.configuration.monkey_patches.include?('hash')
|
|
446
446
|
|
447
447
|
alias to_o to_object
|
448
448
|
|
449
|
+
def to_open_struct(lazy: true)
|
450
|
+
struct = OpenStruct.new(self)
|
451
|
+
struct.methods(lazy)
|
452
|
+
struct
|
453
|
+
end
|
454
|
+
|
455
|
+
def to_struct
|
456
|
+
struct = Struct.new(*keys)
|
457
|
+
struct.new(*values)
|
458
|
+
end
|
459
|
+
|
449
460
|
def update_each
|
450
461
|
replace(each_with_object({}) { |(key, val), hash| hash.update(yield(key, val)) })
|
451
462
|
end
|
data/lib/lite/ruby/object.rb
CHANGED
@@ -115,6 +115,10 @@ if Lite::Ruby.configuration.monkey_patches.include?('object')
|
|
115
115
|
blank? ? placeholder : self
|
116
116
|
end
|
117
117
|
|
118
|
+
def salvage_try(*obj, placeholder: '---', &block)
|
119
|
+
try(*obj, &block).salvage(placeholder)
|
120
|
+
end
|
121
|
+
|
118
122
|
def send_chain(*keys)
|
119
123
|
Array(keys).inject(self) { |obj, key| obj.send(*key) }
|
120
124
|
end
|
@@ -33,12 +33,26 @@ if Lite::Ruby.configuration.monkey_patches.include?('open_struct')
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def attributes
|
36
|
-
|
36
|
+
@table
|
37
37
|
end
|
38
38
|
|
39
39
|
def replace(args)
|
40
40
|
args.each_pair { |key, val| send("#{key}=", val) }
|
41
41
|
end
|
42
42
|
|
43
|
+
def to_hash(table: true)
|
44
|
+
return attributes unless table
|
45
|
+
|
46
|
+
{ table: attributes }
|
47
|
+
end
|
48
|
+
|
49
|
+
alias to_h to_hash
|
50
|
+
|
51
|
+
def to_json(table: true)
|
52
|
+
to_hash(table: table).to_json
|
53
|
+
end
|
54
|
+
|
55
|
+
alias as_json to_json
|
56
|
+
|
43
57
|
end
|
44
58
|
end
|
data/lib/lite/ruby/string.rb
CHANGED
@@ -123,7 +123,7 @@ if Lite::Ruby.configuration.monkey_patches.include?('string')
|
|
123
123
|
end
|
124
124
|
|
125
125
|
def domain
|
126
|
-
return self unless self =~ %r{^(?:\w
|
126
|
+
return self unless self =~ %r{^(?:\w+://)?([^/?]+)(?:/|\?|$)}
|
127
127
|
|
128
128
|
Regexp.last_match(1)
|
129
129
|
end
|
@@ -422,7 +422,7 @@ if Lite::Ruby.configuration.monkey_patches.include?('string')
|
|
422
422
|
end
|
423
423
|
|
424
424
|
def remove_tags!
|
425
|
-
gsub!(%r{
|
425
|
+
gsub!(%r{</?[^>]*>}, '') || self
|
426
426
|
end
|
427
427
|
|
428
428
|
def rotate(amount = 1)
|
@@ -483,7 +483,7 @@ if Lite::Ruby.configuration.monkey_patches.include?('string')
|
|
483
483
|
gsub!(/[^\x00-\x7F]+/, '')
|
484
484
|
gsub!(/[^\w_ \-]+/i, '')
|
485
485
|
gsub!(/[ \-]+/i, '-')
|
486
|
-
gsub!(
|
486
|
+
gsub!(/^-|-$/i, '')
|
487
487
|
downcase! || self
|
488
488
|
end
|
489
489
|
|
data/lib/lite/ruby/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lite-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
-
description:
|
125
|
+
description:
|
126
126
|
email:
|
127
127
|
- j.gomez@drexed.com
|
128
128
|
executables: []
|
@@ -187,7 +187,7 @@ homepage: http://drexed.github.io/lite-ruby
|
|
187
187
|
licenses:
|
188
188
|
- MIT
|
189
189
|
metadata: {}
|
190
|
-
post_install_message:
|
190
|
+
post_install_message:
|
191
191
|
rdoc_options: []
|
192
192
|
require_paths:
|
193
193
|
- lib
|
@@ -202,8 +202,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
202
202
|
- !ruby/object:Gem::Version
|
203
203
|
version: '0'
|
204
204
|
requirements: []
|
205
|
-
rubygems_version: 3.1.
|
206
|
-
signing_key:
|
205
|
+
rubygems_version: 3.1.4
|
206
|
+
signing_key:
|
207
207
|
specification_version: 4
|
208
208
|
summary: Collection of useful Ruby methods for its primitive classes
|
209
209
|
test_files: []
|