ingress 0.3.0 → 0.4.0

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
  SHA256:
3
- metadata.gz: a8f17e43cf5bacf92bc38048ec7e9eb8588e46567d2ac14a86b64664c369c57e
4
- data.tar.gz: ffebe86e57b6539ccee3bf4265e4d9dc103a88260e16354f4e4e1a8280600f00
3
+ metadata.gz: edbb4efc674725b3fcb18ed2651773ecab7af973940f185cb93a94251858a4da
4
+ data.tar.gz: aadc4a71a1946a19227b1b1a09d37372d056d19020c721a55a1c6cb63a251d20
5
5
  SHA512:
6
- metadata.gz: 22e432bad1f93dad170bb773cb259558ed95bebbd5bfd4cb885498609e3b9912136fbb159dd5dfb3af9c6c99350a5ccf9a3582937a9b7443f66aa9a3dfd1668c
7
- data.tar.gz: 9e27effdf8b6f8a222c50c8f7d05fed65447fa22dd8a9e8cffb3bfa25cd67437917377bf57ce57fca0c547ff623545a447af758f451158b475af4439d717baf3
6
+ metadata.gz: a63048555be635ef620c670e5f3fe39db3bc56bce272734141e391834b82cf42f3f8bce5e4ab9f7f752cc71b9b76e50307aa2d163bec8c901f5be9ad2fcacbdb
7
+ data.tar.gz: 555623681279ba944737bbbb77e2b7b5fd65b365dcd840b83581fdb04527839203669977b1d602fe94e720f91fb7e0ab120c889883109a1a89a65490ac357410
@@ -16,6 +16,7 @@ module Ingress
16
16
  def match?(given_action, given_subject, user, options = {})
17
17
  return false unless action_matches?(given_action)
18
18
  return false unless subject_matches?(given_subject)
19
+ return true if ignore_conditions?(given_subject)
19
20
 
20
21
  conditions_match?(user, given_subject, options)
21
22
  end
@@ -35,6 +36,14 @@ module Ingress
35
36
  "*" == subject
36
37
  end
37
38
 
39
+ def ignore_conditions?(given_subject)
40
+ subject_class?(given_subject) && subject_class?(@subject)
41
+ end
42
+
43
+ def subject_class?(subject)
44
+ [Class, Module].include? subject.class
45
+ end
46
+
38
47
  def conditions_match?(user, given_subject, options)
39
48
  conditions.all? do |condition|
40
49
  if condition.arity == 2
@@ -1,3 +1,3 @@
1
1
  module Ingress
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ingress
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alan Skorkin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-26 00:00:00.000000000 Z
11
+ date: 2020-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler