can_opener 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -55,11 +55,11 @@ Remember that CanCan processes abilities in a top down fashion, so add your gene
55
55
 
56
56
  ### But I want to check the IP Address, Project, etc, in the ability!
57
57
 
58
- Inherit `CanOpener::Ability` , setup your accessors, use the `aditional_ability_arguments` class method. Consider the following contrived example:
58
+ Inherit `CanOpener::Ability` , setup your accessors, use the `additional_ability_arguments` class method. Consider the following contrived example:
59
59
 
60
60
  class TakesIpAddress < CanOpener::Ability
61
61
  attr_reader :ip_address
62
- aditional_ability_arguments :ip_address
62
+ additional_ability_arguments :ip_address
63
63
  end
64
64
 
65
65
  class SuperAdmin < TakesIpAddress
@@ -1,31 +1,31 @@
1
1
  module CanOpener
2
2
  class Ability
3
3
  extend Forwardable
4
-
4
+
5
5
  def_delegators :@base, *CanCan::Ability.public_instance_methods
6
6
 
7
7
  attr_accessor :user
8
8
  protected :user=
9
-
9
+
10
10
  def initialize(base, *args)
11
11
  @base = base
12
12
  setup_vars(*args)
13
13
  abilities
14
14
  end
15
-
16
- def self.aditional_ability_arguments(*args)
17
- @@additional_arguments = [:user]
15
+
16
+ def self.additional_ability_arguments(*args)
17
+ @@initializer_arguments = [:user]
18
18
  args.each_with_index do |arg, idx|
19
19
  raise ArgumentError, "user cannot be an additional argument as it is required as the first arg" if arg.to_sym == :user
20
- @@additional_arguments << arg.to_sym
20
+ @@initializer_arguments << arg.to_sym
21
21
  end
22
22
  end
23
-
23
+
24
24
  protected
25
-
25
+
26
26
  def setup_vars(*args)
27
- if @@additional_arguments && @@additional_arguments.length > 0
28
- @@additional_arguments.each_with_index do |arg, idx|
27
+ if @@initializer_arguments && @@initializer_arguments.length > 0
28
+ @@initializer_arguments.each_with_index do |arg, idx|
29
29
  self.class.send(:attr_accessor, arg)
30
30
  self.send("#{arg}=", args[idx])
31
31
  end
@@ -1,3 +1,3 @@
1
1
  module CanOpener
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -142,7 +142,7 @@ describe CanOpener do
142
142
  describe "passing objects to the ability" do
143
143
  class TakesIpAddress < CanOpener::Ability
144
144
  attr_reader :ip_address
145
- aditional_ability_arguments :ip_address
145
+ additional_ability_arguments :ip_address
146
146
  end
147
147
 
148
148
  class SuperAdmin < TakesIpAddress
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: can_opener
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brendon Murphy
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-20 00:00:00 -08:00
18
+ date: 2011-01-21 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies: []
21
21