Skip to content
Browse files

allow to resolve not yet loaded constants (using constantize)

  • Loading branch information...
1 parent c263d7e commit daa0348052d80e89211a7d8e49b88dd287303d5d @dnagir committed Jan 18, 2012
Showing with 6 additions and 3 deletions.
  1. +2 −0 allowy.gemspec
  2. +2 −0 lib/allowy.rb
  3. +1 −2 lib/allowy/registry.rb
  4. +1 −1 lib/allowy/version.rb
View
2 allowy.gemspec
@@ -18,6 +18,8 @@ Gem::Specification.new do |s|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
+
+ s.add_runtime_dependency "i18n"
s.add_runtime_dependency "activesupport"
s.add_development_dependency "rspec"
View
2 lib/allowy.rb
@@ -1,4 +1,6 @@
require 'active_support/concern'
+require 'active_support/inflector'
+
require "allowy/version"
require "allowy/access_control"
require "allowy/registry"
View
3 lib/allowy/registry.rb
@@ -25,8 +25,7 @@ def access_control_for(subject)
end
def class_for(name)
- # TODO: Namespace it
- return ::Object.const_get(name) if ::Object.const_defined?(name)
+ name.constantize rescue nil #TODO: Handle just the NameError
end
end
View
2 lib/allowy/version.rb
@@ -1,3 +1,3 @@
module Allowy
- VERSION = "0.1.1"
+ VERSION = "0.1.2"
end

0 comments on commit daa0348

Please sign in to comment.
Something went wrong with that request. Please try again.