Class: Guarda::PolicyFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/guarda/policy_finder.rb

Defined Under Namespace

Classes: NotFoundError

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(controller_name) ⇒ PolicyFinder

Returns a new instance of PolicyFinder.



5
6
7
# File 'lib/guarda/policy_finder.rb', line 5

def initialize(controller_name)
  @controller_name = controller_name
end

Class Method Details

.find(controller_name) ⇒ Object



9
10
11
# File 'lib/guarda/policy_finder.rb', line 9

def self.find(controller_name)
  new(controller_name).find
end

Instance Method Details

#findObject



13
14
15
# File 'lib/guarda/policy_finder.rb', line 13

def find
  policy_class.presence || raise(NotFoundError, policy_class_name)
end