you_shall_not_pass 0.0.2 → 0.0.3

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: aebfe45a21e352593dba3c1d5cc1baae6e1f9b66
4
- data.tar.gz: 8c6f55da43443b50d645136e4350013195c32e32
3
+ metadata.gz: c2a0082fe593f22ba8a1ccc446061ed132bb3248
4
+ data.tar.gz: f9be21782946d49cd83fe2b694d29ca6a153e07c
5
5
  SHA512:
6
- metadata.gz: 36fa32a3062e4b639f3e0c753335b4258e14d7c08e60ab00b26d824da38b40d00916ce6a2cd080a81ddcc94bf99cb619c51ae0a3b07bcb6e6253382103390b74
7
- data.tar.gz: c90158efd3dd6010b86fb9177f3093f2f7d5865b8aff219bc121a1815a5bd3f4db0b1b4487f217354835f1e5ba361f2f119121f14fa2bb996b64a8cf58efd61a
6
+ metadata.gz: 225b91dba9bc231f7ff0207523bb1f8d360506aa473e9f399de64b44a8482f9d6b50712066b1bd994a03e90e19b42c273594027430642aa63dc6804383fbd791
7
+ data.tar.gz: 19679f956b3282381acbca246d940be8cabf690f1e520f22d6cb0c7258ef52d8fd9d6ace5ead2bda13740af9ef723f0bc2b741717ca08aa3c70303d807a10dfe
@@ -18,6 +18,9 @@ module YouShallNotPass
18
18
  permission.to_s.split("_and_").all? { |policy| can?(policy.to_sym, **args)}
19
19
  elsif permission =~ /_or_/
20
20
  permission.to_s.split("_or_").any? { |policy| can?(policy.to_sym, **args)}
21
+ elsif permission =~ /\Anot_/
22
+ policy = permission.to_s.gsub(/\Anot_/, "")
23
+ ! can?(policy.to_sym, **args)
21
24
  else
22
25
  raise e
23
26
  end
@@ -1,3 +1,3 @@
1
1
  module YouShallNotPass
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -197,6 +197,14 @@ scope YouShallNotPass::Authorizator do
197
197
  ! authorizator.can?(:three_or_four)
198
198
  end
199
199
 
200
+ spec "allow not_" do
201
+ authorizator.can?(:not_three)
202
+ end
203
+
204
+ spec "reject not_" do
205
+ ! authorizator.can?(:not_one)
206
+ end
207
+
200
208
  spec "allow _and_or_" do
201
209
  authorizator.can?(:one_and_two_or_three)
202
210
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: you_shall_not_pass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Federico Iachetti
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-31 00:00:00.000000000 Z
11
+ date: 2015-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler