mongoid_ability 0.1.5 → 0.1.6

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: b0209253f4d3a2037374e99a68afa6770b29990d
4
- data.tar.gz: 0de330daa38560a90247123dfd1aecb9674ab514
3
+ metadata.gz: 9f9c60dd321058f51a039fcefa9c3540a91a8479
4
+ data.tar.gz: 76fa93ef759bfd5921d838ef921231ebec673788
5
5
  SHA512:
6
- metadata.gz: 5cc4cb9300ee1bfcc39d1969c3add556be0399f0fd12501cded61b9f402535229a4e0691caff7706ec9c3008cd50a05cf6514642426973050dc5641d5420344d
7
- data.tar.gz: 0fc9087fcc51d86c025b0daec0e615a0183f97cebb9fe6cb6d6369427ce49214f0cfda81c5f90801a3cd5dafa2f9901e32a1fc49657e414f23ce71a87b81b8a6
6
+ metadata.gz: 764e3d241e12c19c20ac484a5e33ccb03559010337da5f09eb3d1d8a8f3641a40e9d245ad36680975fafd712ef49b563a9185e65d2342c09fc4e788273dde7dc
7
+ data.tar.gz: 6e3869323449bd68052dff3854a45bd92b618f9153d4894e50d7c4fac965ad836d68ec0eab7828db897611154f0e7fcef7d186cf256272dd11d1eea1a0d3f98b
@@ -69,15 +69,9 @@ module MongoidAbility
69
69
  # .select(&current_ability.can_destroy)
70
70
  # etc.
71
71
  def method_missing name, *args
72
- return super unless name.to_s =~ /\Acan_/
73
- return unless action = name.to_s.gsub(/\Acan_/, '').to_sym
74
- lambda { |doc| can? action, doc }
75
- end
76
-
77
- def method_missing name, *args
78
- return super unless name.to_s =~ /\Acannot_/
79
- return unless action = name.to_s.gsub(/\Acannot_/, '').to_sym
80
- lambda { |doc| cannot? action, doc }
72
+ return super unless name.to_s =~ /\A(can|cannot)_/
73
+ return unless action = name.to_s.gsub(/\A(can|cannot)_/, '').to_sym
74
+ name =~ /can_/ ? lambda { |doc| can? action, doc } : lambda { |doc| cannot? action, doc }
81
75
  end
82
76
 
83
77
  end
@@ -1,3 +1,3 @@
1
1
  module MongoidAbility
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_ability
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Celizna