Class: Trestle::DebugErrors
- Inherits:
-
Object
- Object
- Trestle::DebugErrors
- Defined in:
- lib/trestle/debug_errors.rb
Instance Method Summary collapse
- #any? ⇒ Boolean
- #each ⇒ Object
-
#initialize(errors) ⇒ DebugErrors
constructor
A new instance of DebugErrors.
Constructor Details
#initialize(errors) ⇒ DebugErrors
Returns a new instance of DebugErrors.
3 4 5 |
# File 'lib/trestle/debug_errors.rb', line 3 def initialize(errors) @errors = errors end |
Instance Method Details
#any? ⇒ Boolean
7 8 9 |
# File 'lib/trestle/debug_errors.rb', line 7 def any? @errors.any? end |
#each ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/trestle/debug_errors.rb', line 11 def each if defined?(ActiveModel::Error) # Rails 6.1 introduces a unified Error class @errors.each do |error| yield error.attribute, error. end else @errors.each do |error, | yield error, end end end |