rolistic 1.0.0 → 1.1.0
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/lib/rolistic/version.rb +1 -1
- data/lib/rolistic.rb +12 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1a4602b3b7be871f6ff0a39e5fbac10ff31dd80e61c234460ef3a32346123fda
|
|
4
|
+
data.tar.gz: 3f16800397a6ed3f49e8c165a79d3c555e21e6803f21ac64833f1bd1011bb1e5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b9d01d4c3797437da4cc263136edaed33c333b8f199e5ca40fa4a463ef9b914a077128dc961ac8c791712ba9f29f3fde5b7534978417d7d5d6467b345baf85a8
|
|
7
|
+
data.tar.gz: 902a4f997767abb7c97f9fcd85326143b96f41a9d508d55f16e46e4b1410962be876b1dc557b9b4664fb0610da15728684d9406d40ad4cd6e366177d920c0bd5
|
data/lib/rolistic/version.rb
CHANGED
data/lib/rolistic.rb
CHANGED
|
@@ -29,6 +29,18 @@ module Rolistic
|
|
|
29
29
|
name == self.class.default
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
+
# roles are value objects: abilities are derived from the class and name, so
|
|
33
|
+
# two roles of the same class and name are equal. This lets ActiveRecord see
|
|
34
|
+
# assigning an equivalent role as no change.
|
|
35
|
+
def ==(other)
|
|
36
|
+
other.class == self.class && other.name == name
|
|
37
|
+
end
|
|
38
|
+
alias_method :eql?, :==
|
|
39
|
+
|
|
40
|
+
def hash
|
|
41
|
+
[self.class, name].hash
|
|
42
|
+
end
|
|
43
|
+
|
|
32
44
|
def inspect
|
|
33
45
|
"#<#{self.class} :#{to_s}>"
|
|
34
46
|
end
|