Class: Lite::Validation::StructuredError::Record
- Inherits:
-
Object
- Object
- Lite::Validation::StructuredError::Record
- Includes:
- Lite::Validation::StructuredError
- Defined in:
- lib/lite/validation/structured_error/record.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Lite::Validation::StructuredError
Class Method Details
.instance(code, message: nil, data: nil) ⇒ Object
15 16 17 |
# File 'lib/lite/validation/structured_error/record.rb', line 15 def self.instance(code, message: nil, data: nil) new(code.to_sym, &.to_s.freeze, data.freeze) end |
Instance Method Details
#display_message ⇒ Object
19 20 21 |
# File 'lib/lite/validation/structured_error/record.rb', line 19 def (*) end |
#inspect ⇒ Object
23 24 25 |
# File 'lib/lite/validation/structured_error/record.rb', line 23 def inspect "#<#{self.class.name} '#{ || code}'>" end |
#to_hash ⇒ Object
27 28 29 30 31 32 |
# File 'lib/lite/validation/structured_error/record.rb', line 27 def to_hash { code: code }.tap do |hash| hash[:message] = unless .nil? hash[:data] = data unless data.nil? end end |