lite-ruby 1.0.26 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a60b6620f1f96b3e70290ffef9a747511107a86449742e1be095be4aa0ffea91
4
- data.tar.gz: 23e7fdc0cf9e7948812d95b4f36528eb264d7e041f7986d86cf1ebff770d70a0
3
+ metadata.gz: bfc486f31bfbbad993a40604cf0334d8f59b5956cf6020f52c5c7140d4e8f114
4
+ data.tar.gz: 3b4b5b748b28261e8e602c78cb11e91b546b0c03905c07ac6045a4903f295992
5
5
  SHA512:
6
- metadata.gz: 883d36b8714d876f6a5f31da52da55c1da86641033724c94e2e0045e261e6e2427a4f1cb3f2d9bda234d564018f97f4c21efa55e8d9276826cead809d6c7f949
7
- data.tar.gz: a457a5207c0e203689ad0064232032b7419e13c9297e1ad7365ea8f5c0f699736eb5b9851a94c475262b21ab8429ae2772240e8d8f7046b6113ba53b61889d2c
6
+ metadata.gz: c9262f97caffc9c198d750cafa76354501df7ef960e6054c8e236a769c9ac26e07a48ee22f68f4e834b9400533f28d35c865f038aa7af0404c8e671735a2baf6
7
+ data.tar.gz: fb8058ad49733add958510930473bd26d597432e4aae95c15a77c9aff63847a462cb0fd7d1cfda3a96afb98465c8bc9107c89ba73149482565f836d06e0529ae
@@ -20,6 +20,8 @@ Layout/SpaceAroundMethodCallOperator:
20
20
  Enabled: true
21
21
  Lint/DeprecatedOpenSSLConstant:
22
22
  Enabled: true
23
+ Lint/MixedRegexpCaptureTypes:
24
+ Enabled: true
23
25
  Lint/RaiseException:
24
26
  Enabled: true
25
27
  Lint/StructNewOverride:
@@ -53,5 +55,9 @@ Style/HashTransformValues:
53
55
  Enabled: false
54
56
  Style/PerlBackrefs:
55
57
  Enabled: false
58
+ Style/RedundantRegexpCharacterClass:
59
+ Enabled: true
60
+ Style/RedundantRegexpEscape:
61
+ Enabled: true
56
62
  Style/SlicingWithRange:
57
63
  Enabled: false
@@ -6,6 +6,11 @@ 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
+
9
14
  ## [1.0.26] - 2020-05-22
10
15
  ### Changed
11
16
  - Changed hash `to_open_struct` and `to_object` to be independent methods
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lite-ruby (1.0.26)
4
+ lite-ruby (1.0.27)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -25,7 +25,7 @@ GEM
25
25
  minitest (~> 5.1)
26
26
  tzinfo (~> 1.1)
27
27
  zeitwerk (~> 2.2, >= 2.2.2)
28
- ast (2.4.0)
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,7 +38,7 @@ GEM
38
38
  generator_spec (0.9.4)
39
39
  activesupport (>= 3.0.0)
40
40
  railties (>= 3.0.0)
41
- i18n (1.8.2)
41
+ i18n (1.8.3)
42
42
  concurrent-ruby (~> 1.0)
43
43
  loofah (2.5.0)
44
44
  crass (~> 1.0.2)
@@ -49,7 +49,7 @@ GEM
49
49
  nokogiri (1.10.9)
50
50
  mini_portile2 (~> 2.4.0)
51
51
  parallel (1.19.1)
52
- parser (2.7.1.2)
52
+ parser (2.7.1.3)
53
53
  ast (~> 2.4.0)
54
54
  rack (2.2.2)
55
55
  rack-test (1.1.0)
@@ -67,6 +67,7 @@ GEM
67
67
  thor (>= 0.20.3, < 2.0)
68
68
  rainbow (3.0.0)
69
69
  rake (13.0.1)
70
+ regexp_parser (1.7.1)
70
71
  rexml (3.2.4)
71
72
  rspec (3.9.0)
72
73
  rspec-core (~> 3.9.0)
@@ -81,24 +82,25 @@ GEM
81
82
  diff-lcs (>= 1.2.0, < 2.0)
82
83
  rspec-support (~> 3.9.0)
83
84
  rspec-support (3.9.3)
84
- rubocop (0.84.0)
85
+ rubocop (0.85.1)
85
86
  parallel (~> 1.10)
86
87
  parser (>= 2.7.0.1)
87
88
  rainbow (>= 2.2.2, < 4.0)
89
+ regexp_parser (>= 1.7)
88
90
  rexml
89
91
  rubocop-ast (>= 0.0.3)
90
92
  ruby-progressbar (~> 1.7)
91
93
  unicode-display_width (>= 1.4.0, < 2.0)
92
94
  rubocop-ast (0.0.3)
93
95
  parser (>= 2.7.0.1)
94
- rubocop-performance (1.6.0)
96
+ rubocop-performance (1.6.1)
95
97
  rubocop (>= 0.71.0)
96
- rubocop-rspec (1.39.0)
98
+ rubocop-rspec (1.40.0)
97
99
  rubocop (>= 0.68.1)
98
100
  ruby-progressbar (1.10.1)
99
101
  ruby_parser (3.14.2)
100
102
  sexp_processor (~> 4.9)
101
- sexp_processor (4.14.1)
103
+ sexp_processor (4.15.0)
102
104
  thor (1.0.1)
103
105
  thread_safe (0.3.6)
104
106
  tzinfo (1.2.7)
@@ -64,14 +64,24 @@ Returns the value after a given value.
64
64
  ['1', '2', '3'].after('4') #=> nil
65
65
  ```
66
66
 
67
- `bury`
67
+ `all_after`
68
68
  ------
69
- Updates a deeply nested value.
69
+ Returns all values after a given value.
70
70
 
71
71
  ```ruby
72
- ['1', ['2']].bury(1, '3') #=> ['1', '3']
73
- ['1', ['2']].bury(1, 0, '3') #=> ['1', ['3']]
74
- ['1', ['2']].bury(1) #=> raises ArgumentError: '2 or more arguments required'
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.
@@ -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
 
@@ -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{<\/?[^>]*>}, '') || self
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!(/^\-|\-$/i, '')
486
+ gsub!(/^-|-$/i, '')
487
487
  downcase! || self
488
488
  end
489
489
 
@@ -3,7 +3,7 @@
3
3
  module Lite
4
4
  module Ruby
5
5
 
6
- VERSION ||= '1.0.26'
6
+ VERSION ||= '1.0.27'
7
7
 
8
8
  end
9
9
  end
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.26
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-05-22 00:00:00.000000000 Z
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.3
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: []