active_object 4.0.8 → 4.0.9

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
  SHA1:
3
- metadata.gz: 6fc08a3fb5836a6f154a0f1d7854cdafd68dfcea
4
- data.tar.gz: 7deb7107836576302250d73656aaf4c0dd9eccb1
3
+ metadata.gz: f913e9cb5748f85f842d00bd586e9dc60cb41a52
4
+ data.tar.gz: 71a75e1617ac6176e49040967eebeb32b8caecd2
5
5
  SHA512:
6
- metadata.gz: d22be40f8fbe844dc638f0d265d03746816850fe2e1e5484ee67fe8131123588c232470f7d14afb96c3498bc3dfe01e632103c195b2384bd92024fdc5ab0f571
7
- data.tar.gz: cc1543d95b6ca3a04b422ba207ef4af2e7c1700aab01d962953dd7a140e92eb91fc8635421d939d03a472b160af0d5c5e4b5e69bdc3adda3003672e6807cfff6
6
+ metadata.gz: 2ca504cc49a338ff400e78db2fb0571bad7cfd5bc705d2c9983d0c09e761fa2f3be54d0f84c30370d3507ebd2aa0547375bc95911edbeef9aab60a40beef8527
7
+ data.tar.gz: d9cfacf2ac5a0b34cf9f75ab4efb618fc65306fc249e72b64433e47d3ccc08964ef793910e965a22cb7499d760fc654764233d258330ac707d3a4551857d6227
@@ -1,11 +1,25 @@
1
1
  AllCops:
2
2
  DisplayCopNames: true
3
3
  DisplayStyleGuide: true
4
- TargetRubyVersion: 2.3
4
+ TargetRubyVersion: 2.4
5
5
  Exclude:
6
6
  - 'spec/**/**/*'
7
+ Layout/ClosingParenthesisIndentation:
8
+ Enabled: false
9
+ Layout/EmptyLinesAroundBlockBody:
10
+ Enabled: false
11
+ Layout/EmptyLinesAroundClassBody:
12
+ Enabled: false
13
+ Layout/EmptyLinesAroundModuleBody:
14
+ Enabled: false
15
+ Layout/FirstParameterIndentation:
16
+ Enabled: false
17
+ Layout/MultilineMethodCallIndentation:
18
+ EnforcedStyle: aligned
7
19
  LineLength:
8
20
  Max: 100
21
+ Lint/ScriptPermission:
22
+ Enabled: false
9
23
  Metrics/ClassLength:
10
24
  Enabled: false
11
25
  Metrics/ModuleLength:
@@ -16,24 +30,12 @@ Style/BracesAroundHashParameters:
16
30
  Enabled: false
17
31
  Style/ClassAndModuleChildren:
18
32
  EnforcedStyle: compact
19
- Style/ClosingParenthesisIndentation:
20
- Enabled: false
21
33
  Style/Documentation:
22
34
  Enabled: false
23
- Style/EmptyLinesAroundBlockBody:
24
- Enabled: false
25
- Style/EmptyLinesAroundClassBody:
26
- Enabled: false
27
- Style/EmptyLinesAroundModuleBody:
28
- Enabled: false
29
35
  Style/HashSyntax:
30
36
  Enabled: false
31
- Style/FirstParameterIndentation:
32
- Enabled: false
33
37
  Style/FrozenStringLiteralComment:
34
38
  Enabled: false
35
- Style/MultilineMethodCallIndentation:
36
- EnforcedStyle: aligned
37
39
  Style/NumericLiterals:
38
40
  Enabled: false
39
41
  Style/RescueModifier:
@@ -1,15 +1,15 @@
1
1
  module Enumerable
2
2
 
3
- # rubocop:disable Lint/UnusedMethodArgument
3
+ # rubocop:disable Lint/UnusedMethodArgument, Style/YodaCondition
4
4
  def cluster(&block)
5
5
  result = []
6
6
  each do |ele|
7
7
  last_res = result.last
8
- last_res && (yield(last_res.last) == yield(ele)) ? last_res << ele : result << [ele]
8
+ last_res && (yield(ele) == yield(last_res.last)) ? last_res << ele : result << [ele]
9
9
  end
10
10
  result
11
11
  end
12
- # rubocop:enable Lint/UnusedMethodArgument
12
+ # rubocop:enable Lint/UnusedMethodArgument, Style/YodaCondition
13
13
 
14
14
  def difference(identity = 0, &block)
15
15
  if block_given?
@@ -86,13 +86,13 @@ module ActiveObject::Numeric
86
86
  min_min = minimum.min
87
87
  min_max = minimum.max
88
88
 
89
- return min_min if self < min_min
89
+ return min_min if min_min > self
90
90
 
91
- self > min_max ? min_max : self
91
+ min_max < self ? min_max : self
92
92
  else
93
- return minimum if self < minimum
93
+ return minimum if minimum > self
94
94
 
95
- self > maximum ? maximum : self
95
+ maximum < self ? maximum : self
96
96
  end
97
97
  end
98
98
  # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
@@ -176,11 +176,11 @@ module ActiveObject::Numeric
176
176
  alias_method :gram_in_grams, :grams_in_grams
177
177
 
178
178
  def greater_than?(num)
179
- self > num
179
+ num < self
180
180
  end
181
181
 
182
182
  def greater_than_or_equal_to?(num)
183
- self >= num
183
+ num <= self
184
184
  end
185
185
 
186
186
  def hectograms_in_grams
@@ -212,7 +212,7 @@ module ActiveObject::Numeric
212
212
  end
213
213
 
214
214
  def inside?(start, finish)
215
- (start < self) && (self < finish)
215
+ (start < self) && (finish > self)
216
216
  end
217
217
 
218
218
  def kilobytes_in_bytes
@@ -234,11 +234,11 @@ module ActiveObject::Numeric
234
234
  alias_method :kilogram_in_grams, :kilograms_in_grams
235
235
 
236
236
  def less_than?(num)
237
- self < num
237
+ num > self
238
238
  end
239
239
 
240
240
  def less_than_or_equal_to?(num)
241
- self <= num
241
+ num >= self
242
242
  end
243
243
 
244
244
  def metric_tons_in_grams
@@ -303,11 +303,11 @@ module ActiveObject::Numeric
303
303
 
304
304
  alias_method :nautical_mile_in_inches, :nautical_miles_in_inches
305
305
 
306
- # rubocop:disable Style/NumericPredicate
306
+ # rubocop:disable Style/NumericPredicate, Style/YodaCondition
307
307
  def negative?
308
- self < 0
308
+ 0 > self
309
309
  end
310
- # rubocop:enable Style/NumericPredicate
310
+ # rubocop:enable Style/NumericPredicate, Style/YodaCondition
311
311
 
312
312
  def ordinal
313
313
  if (11..13).cover?(abs % 100)
@@ -333,7 +333,7 @@ module ActiveObject::Numeric
333
333
  alias_method :ounce_in_ounces, :ounces_in_ounces
334
334
 
335
335
  def outside?(start, finish)
336
- (self < start) || (finish < self)
336
+ (start > self) || (finish < self)
337
337
  end
338
338
 
339
339
  def pad(options = {})
@@ -375,11 +375,11 @@ module ActiveObject::Numeric
375
375
 
376
376
  alias_method :petabyte_in_bytes, :petabytes_in_bytes
377
377
 
378
- # rubocop:disable Style/NumericPredicate
378
+ # rubocop:disable Style/NumericPredicate, Style/YodaCondition
379
379
  def positive?
380
- self > 0
380
+ 0 < self
381
381
  end
382
- # rubocop:enable Style/NumericPredicate
382
+ # rubocop:enable Style/NumericPredicate, Style/YodaCondition
383
383
 
384
384
  def pounds_in_ounces
385
385
  self * POUND
@@ -535,7 +535,7 @@ module ActiveObject::Numeric
535
535
  alias_method :week_in_seconds, :weeks_in_seconds
536
536
 
537
537
  def within?(number, epsilon = 0.01)
538
- return self == number if epsilon.zero?
538
+ return number == self if epsilon.zero?
539
539
 
540
540
  alpha = to_f
541
541
  beta = number.to_f
@@ -16,9 +16,11 @@ module ActiveObject::Object
16
16
  TRUE_VALUES.include?(self) || FALSE_VALUES.include?(self)
17
17
  end
18
18
 
19
+ # rubocop:disable Style/YodaCondition
19
20
  def false?
20
- self == false
21
+ false == self
21
22
  end
23
+ # rubocop:enable Style/YodaCondition
22
24
 
23
25
  def falsey?
24
26
  nil? || FALSE_VALUES.include?(self)
@@ -72,9 +74,11 @@ module ActiveObject::Object
72
74
  is_a?(Time)
73
75
  end
74
76
 
77
+ # rubocop:disable Style/YodaCondition
75
78
  def true?
76
- self == true
79
+ true == self
77
80
  end
81
+ # rubocop:enable Style/YodaCondition
78
82
 
79
83
  def truthy?
80
84
  TRUE_VALUES.include?(self)
@@ -1,3 +1,3 @@
1
1
  module ActiveObject
2
- VERSION = '4.0.8'.freeze
2
+ VERSION = '4.0.9'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_object
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.8
4
+ version: 4.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-13 00:00:00.000000000 Z
11
+ date: 2017-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable