class ActiveEntry::PolicyFinder

Attributes

class_name[R]

Public Class Methods

new(class_name) click to toggle source
# File lib/active_entry/policy_finder.rb, line 5
def initialize class_name
  @class_name = class_name
end
policy_for(class_name) click to toggle source
# File lib/active_entry/policy_finder.rb, line 10
def policy_for class_name
  new(class_name).policy
end

Public Instance Methods

policy() click to toggle source
# File lib/active_entry/policy_finder.rb, line 15
def policy
  policy_class_name.safe_constantize or raise NotDefinedError.new(policy_class_name, @class_name)
end

Private Instance Methods

policy_class_name() click to toggle source
# File lib/active_entry/policy_finder.rb, line 21
def policy_class_name
  [@class_name, "Policy"].join
end