lite-ruby 2.0.3 → 2.0.7

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: 29e7241b666924e764cb6109751dde2dd55b5964a1a5ee1656e20d44373ab516
4
- data.tar.gz: 875f644d9a7e9bc392b093c0e9d030321e1a1d3230dbd9214f3225df4cdff613
3
+ metadata.gz: 1a7c47f81572dc73bde077ef70e817c16e704ff16e1adfa4d5eeee8b0277f115
4
+ data.tar.gz: 99fc0631ca9de47585a4b7e3759eec15988910dbd4355188bd079218c1114138
5
5
  SHA512:
6
- metadata.gz: 3dc8caff79b7ec516abf91f4eaad29b5377ee092d214bed010b1a56cb176abb8c040b1c79e44bf0947cdb6ab20935586378a7d9f82ea85f51ff1e4dbd561342a
7
- data.tar.gz: d117f070aaefd4a835efce753781a28f330e009863a5843406430e9bc786750efa8f071f66ce189a1c79153e2a658979302844b37d15e4bd01e844b4e6d3fd4c
6
+ metadata.gz: 49d87572e81b873e8c059004a8f395128b2cb421dc4ec76d01a57d6c3fb45cda662945f895bc304466771a586d6646a80c59c88c88c80792ddbd1740afee2010
7
+ data.tar.gz: 97d1291a149678e083f8dff1da8f03009eb60498be4681bf994e877496515db8fac7d2bfe18096caafd2ab268cbabc259d6a609bde1e3e91e8bb2a1271c01d70
data/.rubocop.yml CHANGED
@@ -43,6 +43,8 @@ RSpec/DescribeClass:
43
43
  - 'spec/lite/ruby/boolean_spec.rb'
44
44
  RSpec/ExampleLength:
45
45
  Enabled: false
46
+ RSpec/ExcessiveDocstringSpacing:
47
+ Enabled: false
46
48
  RSpec/MultipleExpectations:
47
49
  Enabled: false
48
50
  Style/ArgumentsForwarding:
data/CHANGELOG.md CHANGED
@@ -6,6 +6,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [2.0.7] - 2021-09-29
10
+ ### Added
11
+ - Added Range => `bounds`
12
+
13
+ ## [2.0.6] - 2021-09-26
14
+ ### Changed
15
+ - Added DateTimeHelper => added missing comma to imperical date
16
+
17
+ ## [2.0.5] - 2021-08-12
18
+ ### Changed
19
+ - Added DateTimeHelper => remove unit fallback to `stamp`
20
+
21
+ ## [2.0.4] - 2021-08-12
22
+ ### Changed
23
+ - Added DateTimeHelper => add unit fallback to `stamp`
24
+
9
25
  ## [2.0.3] - 2021-08-05
10
26
  ### Changed
11
27
  - Added Numeric => `negate`
data/Gemfile.lock CHANGED
@@ -1,25 +1,25 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lite-ruby (2.0.3)
4
+ lite-ruby (2.0.7)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- actionpack (6.1.4)
10
- actionview (= 6.1.4)
11
- activesupport (= 6.1.4)
9
+ actionpack (6.1.4.1)
10
+ actionview (= 6.1.4.1)
11
+ activesupport (= 6.1.4.1)
12
12
  rack (~> 2.0, >= 2.0.9)
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.1.4)
17
- activesupport (= 6.1.4)
16
+ actionview (6.1.4.1)
17
+ activesupport (= 6.1.4.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.1.4)
22
+ activesupport (6.1.4.1)
23
23
  concurrent-ruby (~> 1.0, >= 1.0.2)
24
24
  i18n (>= 1.6, < 2)
25
25
  minitest (>= 5.1)
@@ -40,16 +40,16 @@ GEM
40
40
  railties (>= 3.0.0)
41
41
  i18n (1.8.10)
42
42
  concurrent-ruby (~> 1.0)
43
- loofah (2.11.0)
43
+ loofah (2.12.0)
44
44
  crass (~> 1.0.2)
45
45
  nokogiri (>= 1.5.9)
46
46
  method_source (1.0.0)
47
47
  mini_portile2 (2.6.1)
48
48
  minitest (5.14.4)
49
- nokogiri (1.12.2)
49
+ nokogiri (1.12.5)
50
50
  mini_portile2 (~> 2.6.1)
51
51
  racc (~> 1.4)
52
- parallel (1.20.1)
52
+ parallel (1.21.0)
53
53
  parser (3.0.2.0)
54
54
  ast (~> 2.4.1)
55
55
  racc (1.5.2)
@@ -59,11 +59,11 @@ GEM
59
59
  rails-dom-testing (2.0.3)
60
60
  activesupport (>= 4.2.0)
61
61
  nokogiri (>= 1.6)
62
- rails-html-sanitizer (1.3.0)
62
+ rails-html-sanitizer (1.4.2)
63
63
  loofah (~> 2.3)
64
- railties (6.1.4)
65
- actionpack (= 6.1.4)
66
- activesupport (= 6.1.4)
64
+ railties (6.1.4.1)
65
+ actionpack (= 6.1.4.1)
66
+ activesupport (= 6.1.4.1)
67
67
  method_source
68
68
  rake (>= 0.13)
69
69
  thor (~> 1.0)
@@ -84,25 +84,24 @@ GEM
84
84
  diff-lcs (>= 1.2.0, < 2.0)
85
85
  rspec-support (~> 3.10.0)
86
86
  rspec-support (3.10.2)
87
- rubocop (1.18.4)
87
+ rubocop (1.22.0)
88
88
  parallel (~> 1.10)
89
89
  parser (>= 3.0.0.0)
90
90
  rainbow (>= 2.2.2, < 4.0)
91
91
  regexp_parser (>= 1.8, < 3.0)
92
92
  rexml
93
- rubocop-ast (>= 1.8.0, < 2.0)
93
+ rubocop-ast (>= 1.12.0, < 2.0)
94
94
  ruby-progressbar (~> 1.7)
95
95
  unicode-display_width (>= 1.4.0, < 3.0)
96
- rubocop-ast (1.8.0)
96
+ rubocop-ast (1.12.0)
97
97
  parser (>= 3.0.1.1)
98
- rubocop-performance (1.11.4)
98
+ rubocop-performance (1.11.5)
99
99
  rubocop (>= 1.7.0, < 2.0)
100
100
  rubocop-ast (>= 0.4.0)
101
101
  rubocop-rake (0.6.0)
102
102
  rubocop (~> 1.0)
103
- rubocop-rspec (2.4.0)
104
- rubocop (~> 1.0)
105
- rubocop-ast (>= 1.1.0)
103
+ rubocop-rspec (2.5.0)
104
+ rubocop (~> 1.19)
106
105
  ruby-progressbar (1.11.0)
107
106
  ruby_parser (3.17.0)
108
107
  sexp_processor (~> 4.15, >= 4.15.1)
@@ -110,7 +109,7 @@ GEM
110
109
  thor (1.1.0)
111
110
  tzinfo (2.0.4)
112
111
  concurrent-ruby (~> 1.0)
113
- unicode-display_width (2.0.0)
112
+ unicode-display_width (2.1.0)
114
113
  zeitwerk (2.4.2)
115
114
 
116
115
  PLATFORMS
@@ -129,4 +128,4 @@ DEPENDENCIES
129
128
  rubocop-rspec
130
129
 
131
130
  BUNDLED WITH
132
- 2.2.24
131
+ 2.2.26
data/docs/DATE.md CHANGED
@@ -37,7 +37,7 @@ Converts a `date` object to a predefined format.
37
37
 
38
38
  | Directive | Type | Key | `strftime` | Result |
39
39
  | --- | --- | --- | --- | --- |
40
- | Weekday | Zero-padded | `weekday`, `:weekday_padded` | %d | (01..31) |
40
+ | Weekday | Zero-padded | `:weekday`, `:weekday_padded` | %d | (01..31) |
41
41
  | Weekday | Blank-padded | `:weekday_blank` | %_d | ( 1..31) |
42
42
  | Weekday | Unpadded | `:weekday_unpadded` | %-d | (1..31) |
43
43
  | Weekday | Name | `:weekday_name` | %A | Sunday |
data/docs/RANGE.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Range
2
2
 
3
+ `bounds`
4
+ ------
5
+ Returns the first and last values of a range.
6
+
7
+ ```ruby
8
+ (1..9).bounds #=> [1, 9]
9
+ ```
10
+
3
11
  `combine`
4
12
  ------
5
13
  Returns two concatenated ranges.
@@ -29,6 +29,6 @@ week_year_iso: '%V-%G'
29
29
  year_day: '%Y-%m-%d'
30
30
  year_month: '%Y-%m'
31
31
  year_week: '%G-%V'
32
- date: '%B %-d %Y'
33
- date_abbr: '%b %-d %Y'
32
+ date: '%B %-d, %Y'
33
+ date_abbr: '%b %-d, %Y'
34
34
  date_iso: '%Y-%m-%d'
@@ -28,15 +28,15 @@ daytime_iso: '%m-%d %H:%M'
28
28
  daytime12: '%B %-d %I:%M %P'
29
29
  daytime12_abbr: '%b %-d %I:%M %P'
30
30
  daytime12_iso: '%m-%d %I:%M %P'
31
- datetime: '%B %-d %Y %H:%M'
32
- datetime_abbr: '%b %-d %Y %H:%M'
31
+ datetime: '%B %-d, %Y %H:%M'
32
+ datetime_abbr: '%b %-d, %Y %H:%M'
33
33
  datetime_iso: '%Y-%m-%d %H:%M'
34
- datetime12: '%B %-d %Y %I:%M %P'
35
- datetime12_abbr: '%b %-d %Y %I:%M %P'
34
+ datetime12: '%B %-d, %Y %I:%M %P'
35
+ datetime12_abbr: '%b %-d, %Y %I:%M %P'
36
36
  datetime12_iso: '%Y-%m-%d %I:%M %P'
37
- datetime_tzn: '%B %-d %Y %H:%M %Z'
38
- datetime_abbr_tzn: '%b %-d %Y %H:%M %Z'
37
+ datetime_tzn: '%B %-d, %Y %H:%M %Z'
38
+ datetime_abbr_tzn: '%b %-d, %Y %H:%M %Z'
39
39
  datetime_iso_tzn: '%Y-%m-%d %H:%M %z'
40
- datetime12_tzn: '%B %-d %Y %I:%M %P %Z'
41
- datetime12_abbr_tzn: '%b %-d %Y %I:%M %P %Z'
40
+ datetime12_tzn: '%B %-d, %Y %I:%M %P %Z'
41
+ datetime12_abbr_tzn: '%b %-d, %Y %I:%M %P %Z'
42
42
  datetime12_iso_tzn: '%Y-%m-%d %I:%M %P %z'
@@ -13,8 +13,8 @@ module Lite
13
13
  end
14
14
 
15
15
  def stamp(key = nil)
16
- key = key.nil? ? self.class::DEFAULT_STAMP : key.to_s
17
- strftime(self.class::STAMPS[key])
16
+ key ||= self.class::DEFAULT_STAMP
17
+ strftime(self.class::STAMPS[key.to_s])
18
18
  end
19
19
 
20
20
  alias to_format stamp
@@ -48,9 +48,11 @@ class Integer
48
48
  (0...num).inject(1) { |acc, i| (acc * (self - i)) / (i + 1) }
49
49
  end
50
50
 
51
+ # rubocop:disable Lint/AmbiguousRange
51
52
  def factorial
52
53
  (1..self).inject { |acc, i| acc * i } || 0
53
54
  end
55
+ # rubocop:enable Lint/AmbiguousRange
54
56
 
55
57
  def factors
56
58
  limit = Math.sqrt(self).floor
@@ -23,7 +23,7 @@ class Numeric
23
23
  if a.zero? || b.zero?
24
24
  (a - b).abs < epsilon
25
25
  else
26
- (a / b - 1).abs < epsilon
26
+ ((a / b) - 1).abs < epsilon
27
27
  end
28
28
  end
29
29
 
@@ -228,9 +228,11 @@ class Numeric
228
228
  "#{pad_precision(options.only(:precision))}#{unit}"
229
229
  end
230
230
 
231
+ # rubocop:disable Lint/AmbiguousRange
231
232
  def to_range
232
- negative? ? self..-self : -self..self
233
+ negative? ? (self..-self) : (-self..self)
233
234
  end
235
+ # rubocop:enable Lint/AmbiguousRange
234
236
 
235
237
  def within?(number, epsilon = 0.01)
236
238
  return number == self if epsilon.zero?
@@ -241,7 +243,7 @@ class Numeric
241
243
  if alpha.zero? || beta.zero?
242
244
  (alpha - beta).abs < epsilon
243
245
  else
244
- (alpha / beta - 1).abs < epsilon
246
+ ((alpha / beta) - 1).abs < epsilon
245
247
  end
246
248
  end
247
249
 
@@ -2,6 +2,10 @@
2
2
 
3
3
  class Range
4
4
 
5
+ def bounds
6
+ [self.begin, self.end]
7
+ end
8
+
5
9
  def combine(other)
6
10
  to_a.concat(other.to_a)
7
11
  end
@@ -47,7 +47,7 @@ class Array
47
47
  elsif fill_with == false
48
48
  collection = self
49
49
  else
50
- padding = (number - size % number) % number
50
+ padding = (number - (size % number)) % number
51
51
  collection = dup.concat(Array.new(padding, fill_with))
52
52
  end
53
53
 
@@ -3,7 +3,7 @@
3
3
  module Lite
4
4
  module Ruby
5
5
 
6
- VERSION = '2.0.3'
6
+ VERSION = '2.0.7'
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: 2.0.3
4
+ version: 2.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-05 00:00:00.000000000 Z
11
+ date: 2021-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -227,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
227
227
  - !ruby/object:Gem::Version
228
228
  version: '0'
229
229
  requirements: []
230
- rubygems_version: 3.2.24
230
+ rubygems_version: 3.2.26
231
231
  signing_key:
232
232
  specification_version: 4
233
233
  summary: Collection of useful Ruby methods for its primitive classes