Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

refactored for late-binding of Role class

  • Loading branch information...
commit 7a2f1dd224a704036b5b040a219279f9ecd6ac59 1 parent a545312
@kristianmandrup authored
Showing with 7 additions and 5 deletions.
  1. +7 −5 lib/roles_generic/generic/role.rb
View
12 lib/roles_generic/generic/role.rb
@@ -6,17 +6,19 @@ def role_class
end
module ClassMethods
+ attr_accessor :class_constant
+
def role_class_name
- @role_class_name
- end
-
- def role_class class_constant
const = class_constant.to_s.camelize
begin
- @role_class_name = "#{const}".constantize
+ @role_class_name ||= "#{const}".constantize
rescue
puts "Role class constant '#{const}' is not defined so it could not be set!"
end
end
+
+ def role_class class_constant
+ @class_constant = class_constant
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.