six 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/six.rb +6 -4
- metadata +2 -2
data/lib/six.rb
CHANGED
@@ -28,7 +28,7 @@ class Six
|
|
28
28
|
# == Returns:
|
29
29
|
# self or false
|
30
30
|
#
|
31
|
-
def
|
31
|
+
def use_pack(name)
|
32
32
|
if pack_exist?(name)
|
33
33
|
@current_rule_pack = name.to_sym
|
34
34
|
self
|
@@ -36,8 +36,8 @@ class Six
|
|
36
36
|
end
|
37
37
|
|
38
38
|
# Same as use but raise exception if no pack found
|
39
|
-
def
|
40
|
-
|
39
|
+
def use_pack!(name)
|
40
|
+
use_pack(name) ? self : raise_no_such_pack
|
41
41
|
end
|
42
42
|
|
43
43
|
# Add pack to authorization class
|
@@ -127,7 +127,7 @@ class Six
|
|
127
127
|
# == Returns:
|
128
128
|
# true or false
|
129
129
|
#
|
130
|
-
def allowed?(
|
130
|
+
def allowed?(object, action, subject)
|
131
131
|
if current_rule_pack
|
132
132
|
rules_packs[current_rule_pack].allowed(object, subject).include?(action)
|
133
133
|
else
|
@@ -153,6 +153,8 @@ class Six
|
|
153
153
|
|
154
154
|
# shotcuts for long methods
|
155
155
|
|
156
|
+
alias_method :use, :use_pack
|
157
|
+
alias_method :use!, :use_pack!
|
156
158
|
alias_method :add, :add_pack
|
157
159
|
alias_method :add!, :add_pack!
|
158
160
|
alias_method :remove, :remove_pack
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: six
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-08-
|
12
|
+
date: 2011-08-27 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description: Very simple authorization gem
|
15
15
|
email: dmitriy.zaporozhets@gmail.com
|