you_shall_not_pass 0.3.0 → 0.3.1

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: e20c5005c72aeb739cd71a80056cf3dd04db7364
4
- data.tar.gz: a2d58f582174be34a55deaf1ccce28a13d446b7b
3
+ metadata.gz: 0ebad4de4047910ba8bc2684832012f9669ad584
4
+ data.tar.gz: 644514d9430543ac82fc12156b1c788e7742b806
5
5
  SHA512:
6
- metadata.gz: 7b8a0d94504f61cb291fa8b82887d1451cbc9b70bdda75c34514ce127d430ffc9a3f7b37c29bf198d1973707b1b38ba7c47a081e1950970b70a813d691523c41
7
- data.tar.gz: c02af7ba490bdc94d797905d58232bb8ca06a3b713ac50c9504ebf10d804a551ed1bc955e53058646378e08e8dbf848eb7003f89020e0e223db3cd966a1c85b0
6
+ metadata.gz: c3f670c878377f76dd39e58971eace445b2f176ffc59160c41d526d2799e6922f95f06b2e8cf14e9e653defc1da346ec31172f41947e9bc352575d63297e9138
7
+ data.tar.gz: b3a1b8c9c9a550372727581bdafe217c58be3930d2db122a1e1ad1c54267be948cd59a92f913881b2d6a7f523f6dc607077338101802f9ec4e5ea01d4abb3e8d
@@ -87,7 +87,7 @@ module YouShallNotPass
87
87
  end
88
88
 
89
89
  def self.policy(name, &block)
90
- __dsl_policies__[name] = block
90
+ __dsl_policies__[name] = proc { block }
91
91
  end
92
92
 
93
93
  def self.attribute(attr)
@@ -1,3 +1,3 @@
1
1
  module YouShallNotPass
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -207,7 +207,7 @@ scope YouShallNotPass::Authorizator do
207
207
  @i_can = true
208
208
  end
209
209
 
210
- !! defined? @i_can
210
+ @i_can
211
211
  end
212
212
  end
213
213
 
@@ -456,7 +456,10 @@ scope YouShallNotPass::Authorizator do
456
456
  policy(:true) { true }
457
457
  policy(:false) { false }
458
458
 
459
- policy(:login) { user == pass}
459
+ policy(:login) { |user:, pass:| user == pass}
460
+
461
+ policy(:use_args) { |**args| args.all? { |k, v| k == v } }
462
+
460
463
  end
461
464
 
462
465
  let(:authorizator) { DslAuthorizator.new(user: "fede", pass: "fede") }
@@ -470,7 +473,11 @@ scope YouShallNotPass::Authorizator do
470
473
  end
471
474
 
472
475
  spec do
473
- authorizator.can?(:login)
476
+ authorizator.can?(:login, user: "u", pass: "u")
477
+ end
478
+
479
+ spec "creates with params" do
480
+ authorizator.can?(:use_args, a: :a, b: :b)
474
481
  end
475
482
 
476
483
  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.3.0
4
+ version: 0.3.1
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-09-07 00:00:00.000000000 Z
11
+ date: 2015-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler