credentials 2.4.2 → 2.4.3

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY CHANGED
@@ -1,3 +1,11 @@
1
+ === 2.4.3 / 2010-01-25
2
+
3
+ * Ruby 1.9 compatibility issue in ActionController extension.
4
+
5
+ === 2.4.2 / 2010-01-25
6
+
7
+ * Bug where class/subclass wasn't recognised as a match.
8
+
1
9
  === 2.4.1 / 2010-01-25
2
10
 
3
11
  * Minor patch to Rulebook fo metaclass support.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.4.2
1
+ 2.4.3
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{credentials}
8
- s.version = "2.4.2"
8
+ s.version = "2.4.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matt Powell"]
12
- s.date = %q{2010-01-25}
12
+ s.date = %q{2010-01-30}
13
13
  s.description = %q{A generic actor/resource permission framework based on rules, not objects.}
14
14
  s.email = %q{fauxparse@gmail.com.com}
15
15
  s.extra_rdoc_files = [
@@ -11,3 +11,31 @@ Object.send :include, Credentials::Extensions::Object
11
11
  if defined?(ActionController)
12
12
  ActionController::Base.send :include, Credentials::Extensions::ActionController
13
13
  end
14
+
15
+ unless defined?(ActiveSupport)
16
+ class String
17
+ if Module.method(:const_get).arity == 1
18
+ def constantize
19
+ names = split('::')
20
+ names.shift if names.empty? || names.first.empty?
21
+
22
+ constant = Object
23
+ names.each do |name|
24
+ constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
25
+ end
26
+ constant
27
+ end
28
+ else
29
+ def constantize
30
+ names = split('::')
31
+ names.shift if names.empty? || names.first.empty?
32
+
33
+ constant = Object
34
+ names.each do |name|
35
+ constant = constant.const_get(name, false) || constant.const_missing(name)
36
+ end
37
+ constant
38
+ end
39
+ end
40
+ end
41
+ end
@@ -83,7 +83,11 @@ module Credentials
83
83
 
84
84
  raise Credentials::Errors::NotLoggedInError unless current_user
85
85
  evaluated = args.map do |arg|
86
- (arg.is_a?(Symbol) && respond_to?(arg) && !public_methods.include?(arg.to_s)) ? send(arg) : arg
86
+ if arg.is_a?(Symbol) && respond_to?(arg) && !action_named?(arg)
87
+ send(arg)
88
+ else
89
+ arg
90
+ end
87
91
  end
88
92
 
89
93
  opts = returning({}) do |hash|
@@ -99,6 +103,11 @@ module Credentials
99
103
  end
100
104
  end
101
105
 
106
+ def action_named?(method)
107
+ method_name = (RUBY_VERSION.to_f >= 1.9) ? method.to_sym : method.to_s
108
+ public_methods.include?(method_name)
109
+ end
110
+
102
111
  def self.included(receiver) #:nodoc:
103
112
  receiver.extend Credentials::Extensions::Configuration
104
113
  receiver.extend ClassMethods
@@ -11,6 +11,7 @@ if defined?(ActionController)
11
11
  def public; end
12
12
  def dangerous; end
13
13
  def create; end
14
+ def view; end
14
15
 
15
16
  def rescue_action(e)
16
17
  raise e
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: credentials
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.2
4
+ version: 2.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Powell
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-25 00:00:00 +13:00
12
+ date: 2010-01-30 00:00:00 +13:00
13
13
  default_executable:
14
14
  dependencies: []
15
15