Class: PolicyCheck::Error
- Inherits:
-
Object
- Object
- PolicyCheck::Error
- Defined in:
- lib/policy_check/error.rb
Overview
Model representing one error defined in the #policy block
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
- #error? ⇒ Boolean
- #error_message ⇒ Object
-
#initialize(model, message, &block) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(model, message, &block) ⇒ Error
Returns a new instance of Error.
6 7 8 9 10 |
# File 'lib/policy_check/error.rb', line 6 def initialize(model, , &block) @model = model @block = block @message = end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
11 12 13 |
# File 'lib/policy_check/error.rb', line 11 def @message end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
11 12 13 |
# File 'lib/policy_check/error.rb', line 11 def model @model end |
Instance Method Details
#error? ⇒ Boolean
13 14 15 |
# File 'lib/policy_check/error.rb', line 13 def error? model.instance_eval(&@block) end |
#error_message ⇒ Object
17 18 19 |
# File 'lib/policy_check/error.rb', line 17 def error? ? : nil end |