abstract_auth 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/LICENSE +1 -1
- data/README.md +15 -0
- data/lib/abstract_auth/abstract_auth.rb +2 -1
- data/lib/abstract_auth/version.rb +1 -1
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -3,6 +3,21 @@
|
|
3
3
|
##WARNING
|
4
4
|
|
5
5
|
This gem is still under development and may change significantly.
|
6
|
+
Currently, you should do the following...
|
7
|
+
|
8
|
+
* instance_eval the returns of your `invoke` calls
|
9
|
+
* not pass args to your `invoke` calls
|
10
|
+
|
11
|
+
class SampleController < ::ApplicationController
|
12
|
+
before_filter :check_authenticated
|
13
|
+
private
|
14
|
+
def check_authenticated
|
15
|
+
redirect_to root_path if !(instance_eval &AbstractAuth.invoke(:authenticated_resource))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
This keeps thing readable for your end users, but a little messy for
|
20
|
+
you. Working fast on a fix.
|
6
21
|
|
7
22
|
##A Short Story
|
8
23
|
|
@@ -12,10 +12,11 @@ module AbstractAuth
|
|
12
12
|
@@implementations.merge!( { requirement => blk } )
|
13
13
|
end
|
14
14
|
|
15
|
+
# @todo Fix this method so that it works with args
|
15
16
|
def self.invoke( method , *args )
|
16
17
|
raise AbstractAuth::Errors::NonRequiredImplementationCallError.new('The requested implementation was not required!') unless @@requirements.include?(method)
|
17
18
|
raise AbstractAuth::Errors::NotImplementedError.new('The requirement was not implemented!') unless @@implementations.has_key?(method)
|
18
|
-
@@implementations[method]
|
19
|
+
@@implementations[method]
|
19
20
|
end
|
20
21
|
|
21
22
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abstract_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Cook
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-12 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|