Module: Isomorfeus
- Defined in:
- lib/isomorfeus/policy/config.rb,
lib/isomorfeus/policy/version.rb
Defined Under Namespace
Modules: Policy
Class Method Summary collapse
Instance Method Summary collapse
- #add_valid_policy_class(klass) ⇒ Object
- #cached_policy_class(class_name) ⇒ Object
- #valid_policy_class_name?(class_name) ⇒ Boolean
- #valid_policy_class_names ⇒ Object
Class Method Details
.cached_policy_classes ⇒ Object
3 4 5 |
# File 'lib/isomorfeus/policy/config.rb', line 3 def cached_policy_classes @cached_array_classes ||= {} end |
Instance Method Details
#add_valid_policy_class(klass) ⇒ Object
29 30 31 32 33 |
# File 'lib/isomorfeus/policy/config.rb', line 29 def add_valid_policy_class(klass) class_name = klass.name class_name = class_name.split('>::').last if class_name.start_with?('#<') valid_policy_class_names << class_name end |
#cached_policy_class(class_name) ⇒ Object
8 9 10 11 12 |
# File 'lib/isomorfeus/policy/config.rb', line 8 def cached_policy_class(class_name) return "::#{class_name}".constantize if Isomorfeus.development? return cached_policy_classes[class_name] if cached_policy_classes.key?(class_name) cached_policy_classes[class_name] = "::#{class_name}".constantize end |
#valid_policy_class_name?(class_name) ⇒ Boolean
25 26 27 |
# File 'lib/isomorfeus/policy/config.rb', line 25 def valid_policy_class_name?(class_name) valid_policy_class_names.include?(class_name) end |
#valid_policy_class_names ⇒ Object
21 22 23 |
# File 'lib/isomorfeus/policy/config.rb', line 21 def valid_policy_class_names @valid_policy_class_names ||= Set.new end |