cancan-export 0.2.2 → 0.2.3

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: 10a93cff61fd331d14f87f89c16b60b81aa3979e
4
- data.tar.gz: 5d1b0c6a9c4b7bc5c455e7dd3b7cce9a1d19c177
3
+ metadata.gz: 87e2dbeeaf098018c03fcf91e740c1ee83f5840e
4
+ data.tar.gz: 0a533b49331d5e44c929f57872ec240b5585501f
5
5
  SHA512:
6
- metadata.gz: 198421aaca5506effa3956495c162eccbff2f4afd64e8d10c0c6b70ba27ad6dc15191f9ba2cd77f76cae074515cd09ed0db848ba22d4149f44b6bb49d68d1977
7
- data.tar.gz: 1f68e1af4f9dbf981833d8bbba394b9137358b797c2ef6b7c11156ba0406f5268db113e9341eeedcbed47145a652e4674f49fd1b0f4998941dbbd1b038bb3c63
6
+ metadata.gz: 91b9813bf3e091f9d609040e885994c9b18492883cc57ed792248cfa455539cd79ab7384d9c0d33777ef89647b90b862d8deec3cb37a6561a72db6ce3823d63c
7
+ data.tar.gz: e4d954ddf61ba271e830daf8d5b3fc9db57bd89d4e6b21b98efdef53ff2936dfc037d5a8bf7b428ff185d11b2e904fd8dcbb42b93152b69244bda6fa02ef76b7
@@ -27,8 +27,8 @@
27
27
 
28
28
  # @ data : [gon Object]
29
29
  constructor: (data) ->
30
- @user = data.user
31
30
  $.extend @, data.ability
31
+ @[@userProperty or 'user'] = data.user
32
32
 
33
33
  # Import each helper defined in ruby's Ability object.
34
34
  # `this' must be the object in which context `user' property is defined, thus it is Ability itself
@@ -13,6 +13,10 @@ module CanCan
13
13
  }.to_h
14
14
  end
15
15
 
16
+ def user_as(property_name)
17
+ @user_property = property_name
18
+ end
19
+
16
20
  def helper_methods
17
21
  @helpers ||= {}
18
22
  end
@@ -25,7 +29,8 @@ module CanCan
25
29
  rulesIndex: @rules_index.map {|object, indices|
26
30
  [object.to_s, indices]
27
31
  }.to_h,
28
- helpersSource: helper_methods
32
+ helpersSource: helper_methods,
33
+ userProperty: @user_property
29
34
  }.to_json(options)
30
35
  end
31
36
 
@@ -1,5 +1,5 @@
1
1
  module CanCan
2
2
  module Export
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cancan-export
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Baev