cancan_namespace 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,8 +8,14 @@ module CanCanNamespace
8
8
  # and subject respectively (such as :read, @project). The third argument is a hash
9
9
  # of conditions and the last one is the block passed to the "can" call.
10
10
  def initialize(base_behavior, action, subject, conditions, block)
11
+ if conditions.kind_of?(Hash) && conditions.has_key?(:context)
12
+ @contexts = [conditions.delete(:context)].flatten.map(&:to_s)
13
+ conditions = nil if conditions.keys.empty?
14
+ else
15
+ @contexts = []
16
+ end
17
+
11
18
  super
12
- @contexts = has_conditions? && @conditions.has_key?(:context) ? [@conditions.delete(:context)].flatten.map(&:to_s) : []
13
19
  end
14
20
 
15
21
  def has_conditions?
@@ -3,7 +3,7 @@ module CancanNamespace
3
3
  module Version
4
4
  MAJOR = 0
5
5
  MINOR = 1
6
- RELEASE = 1
6
+ RELEASE = 2
7
7
 
8
8
  def self.dup
9
9
  "#{MAJOR}.#{MINOR}.#{RELEASE}"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cancan_namespace
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Igor Galeta
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-03-29 00:00:00 +03:00
19
+ date: 2011-04-09 00:00:00 +03:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency