Module: Policy::Interface

Defined in:
lib/policy/interface.rb

Overview

Policy object interface

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object


9
10
11
# File 'lib/policy/interface.rb', line 9

def self.included(klass)
  klass.extend(ClassMethods).__send__(:include, Validations)
end

Instance Method Details

#applyundefined

Validates the policy object

Returns:

  • (undefined)

Raises:


42
43
44
# File 'lib/policy/interface.rb', line 42

def apply
  fail ViolationError.new(self) unless valid?
end

#messagesArray<String>

Returns the list of error messages

Returns:

  • (Array<String>)

32
33
34
# File 'lib/policy/interface.rb', line 32

def messages
  errors.messages.values.flatten
end