pundit_extra 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df435f64ec3d897e435b2292f0708c2908cec6f0
4
- data.tar.gz: fec3495f222f0f7ddc07d4e35326c2331dc766c1
3
+ metadata.gz: 340bc87e37b86b2aea59c99812302fa2e616af91
4
+ data.tar.gz: 79f3d9754889cfdd68b6abd182758a1546634238
5
5
  SHA512:
6
- metadata.gz: a65374449905de751559da4c65a661218033240694de04e2afe34ed78d6d776061e2645e387f044f1a062f0d26b1cd3e796514a06acb539c3d7138d1bb6527e5
7
- data.tar.gz: 732d987ee1b6376c280e7889158b67b8eb2f57132b2af3de133b4d5ae4672bf4fa70a2d4d2ea98f9c328cc224e57d0103f015b5be73905e6da3fb80ac4c6ccde
6
+ metadata.gz: e589da8632dad772df73e3418e4f0f1523127c3b9dd3c3e31bff25373ffdf1fec361647d16380fc76033bbbc07a6931129b53b7fa37f4425041e2d93c900cc1a
7
+ data.tar.gz: 6c0ef3c7cb6f5288d3ef617428722930dae635db8f79de522c23f0bdccda240f940bf42d5ddb31f279fe5545043b0d7101e43accd73a168e03fb8d4ea78b54f6
data/README.md CHANGED
@@ -11,6 +11,14 @@ This library borrows functionality from [CanCan(Can)][2] and adds it to [Pundit]
11
11
  - `load_resource`, `authorize_resource`, `load_and_authorize_resource` and
12
12
  `skip_authorization` controller filters
13
13
 
14
+ The design intentions were:
15
+
16
+ 1. To ease the transition from CanCanCan to Pundit.
17
+ 2. To reduce boilerplate code in controller methods.
18
+ 3. To keep things simple and intentionally avoid dealing with edge cases or
19
+ endless magical options you need to memorize.
20
+
21
+ ---
14
22
 
15
23
  ## Install
16
24
 
@@ -32,12 +40,12 @@ end
32
40
 
33
41
  ## View Helpers: `can?` and `cannot?`
34
42
 
35
- You can use the convenience methods `can?` and `cannot?` in any convreoller
43
+ You can use the convenience methods `can?` and `cannot?` in any controller
36
44
  and view.
37
45
 
38
- `if can? :assign, @task` is the same as Pundit's `policy(@task).assign?`
39
- `if can? :index, Task` is the same as Pundit's `policy(Task).index?`
40
- `if cannot? :assign, @task` is the opposite of `can?`
46
+ - `if can? :assign, @task` is the same as Pundit's `policy(@task).assign?`
47
+ - `if can? :index, Task` is the same as Pundit's `policy(Task).index?`
48
+ - `if cannot? :assign, @task` is the opposite of `can?`
41
49
 
42
50
 
43
51
  ## Autoload and Authorize Resource
data/lib/pundit_extra.rb CHANGED
@@ -1,3 +1,4 @@
1
1
  require "pundit_extra/controller_mixin"
2
2
  require "pundit_extra/helpers"
3
3
  require "pundit_extra/resource_autoload"
4
+ require "pundit_extra/version"
@@ -6,15 +6,15 @@ module PunditExtra
6
6
 
7
7
  module ClassMethods
8
8
  def load_resource(options={})
9
- before_filter :load_resource, options.dup
9
+ before_action :load_resource, options.dup
10
10
  end
11
11
 
12
12
  def authorize_resource(options={})
13
- before_filter :authorize_resource, options.dup
13
+ before_action :authorize_resource, options.dup
14
14
  end
15
15
 
16
16
  def skip_authorization(options={})
17
- before_filter :skip_authorization_and_scope, options.dup
17
+ before_action :skip_authorization_and_scope, options.dup
18
18
  end
19
19
 
20
20
  def load_and_authorize_resource(options={})
@@ -22,7 +22,7 @@ module PunditExtra
22
22
  load_resource options
23
23
  authorize_resource options
24
24
  # :nocov:
25
- end
25
+ end
26
26
  end
27
27
 
28
28
  def load_resource
@@ -1,3 +1,3 @@
1
1
  module PunditExtra
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pundit_extra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-10 00:00:00.000000000 Z
11
+ date: 2016-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: combustion
@@ -30,42 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.5'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '0.5'
41
- - !ruby/object:Gem::Dependency
42
- name: run-gem-dev
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '0.3'
33
+ version: '0.7'
48
34
  type: :development
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
38
  - - "~>"
53
39
  - !ruby/object:Gem::Version
54
- version: '0.3'
40
+ version: '0.7'
55
41
  - !ruby/object:Gem::Dependency
56
- name: runfile-exec
42
+ name: runfile-tasks
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
45
  - - "~>"
60
46
  - !ruby/object:Gem::Version
61
- version: '0.2'
47
+ version: '0.4'
62
48
  type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
52
  - - "~>"
67
53
  - !ruby/object:Gem::Version
68
- version: '0.2'
54
+ version: '0.4'
69
55
  description: Add some helpers and additional functionality to Pundit.
70
56
  email: db@dannyben.com
71
57
  executables: []