lazy_record 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 07cbe5f933ea1780f957807536c3f05412f58b90
4
- data.tar.gz: 58c255f8b4fc88e4b7cbfdbe2e538f56b29bdbc1
3
+ metadata.gz: 56bce37d54f4018b548f48e32c8605d63bced313
4
+ data.tar.gz: 1d1df3c2c2285cd238f49ead0d883897c6a8dc2e
5
5
  SHA512:
6
- metadata.gz: 919c9550309645c00316467c6479a812046b0849feb0fd4a7c3a10e5dd14374d72c83db91fd91f44cef8add1cd15728e2e572cee6a7660c921ba0118bfae98f5
7
- data.tar.gz: 10a6e39dd1dd694838e437b83965988f8e84fd3b6bad4e7ec7fd4f26087e8882d832e12a360cf9477603a8673d6c9b6f94d6f7f221d324460a410e69b9ca3adc
6
+ metadata.gz: 0acbf3c1895d7bd1501f7f4558dae2f548273eda3052d0b6f2b4a236232ed5db0b6da310c09634ca340a89f44a24192851d729144c067ab54839998ece509ad7
7
+ data.tar.gz: 96fea24cfc627e8f88d6ca0dd45c8122daaeef7c5aa6ce40ee345ae51d2e7a47866a54f6314b7e853a732853ccb486169c28268ac5f30113e8d02871f1522955
@@ -42,17 +42,17 @@ module LazyRecord
42
42
  end
43
43
 
44
44
  def ==(other)
45
- conditions = set_equality_conditions
46
- return false if !other.is_a?(self.class) || conditions.empty?
47
- conditions.all? { |attr| send(attr) == other.send(attr) }
45
+ compare(other, :==)
48
46
  end
49
47
 
50
48
  def ===(other)
49
+ compare(other, :===)
50
+ end
51
+
52
+ def compare(other, operator)
51
53
  conditions = set_equality_conditions
52
54
  return false if !other.is_a?(self.class) || conditions.empty?
53
- # rubocop:disable Style/CaseEquality
54
- conditions.all? { |attr| send(attr) === other.send(attr) }
55
- # rubocop:enable Style/CaseEquality
55
+ conditions.all? { |attr| send(attr).send(operator, other.send(attr)) }
56
56
  end
57
57
 
58
58
  def hash
@@ -73,11 +73,10 @@ module LazyRecord
73
73
  end
74
74
 
75
75
  def public_attr_readers_to_s
76
- @public_attr_readers_to_s ||=
77
- self.class.send(:public_attr_readers).map do |attr|
78
- value = send(attr)
79
- "#{attr}: #{stringify_value(value)}"
80
- end
76
+ self.class.send(:public_attr_readers).map do |attr|
77
+ value = send(attr)
78
+ "#{attr}: #{stringify_value(value)}"
79
+ end
81
80
  end
82
81
 
83
82
  def associations_to_s
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LazyRecord
4
- VERSION = '0.6.2'
4
+ VERSION = '0.6.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lazy_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - M. Simon Borg
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-19 00:00:00.000000000 Z
11
+ date: 2017-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport