Class: Gruf::Errors::Field
- Inherits:
-
Object
- Object
- Gruf::Errors::Field
- Defined in:
- lib/gruf/errors/field.rb
Overview
Represents a field-specific error
Instance Attribute Summary collapse
-
#error_code ⇒ Object
readonly
Returns the value of attribute error_code.
-
#field_name ⇒ Object
readonly
Returns the value of attribute field_name.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(field_name, error_code, message = '') ⇒ Field
constructor
A new instance of Field.
-
#to_h ⇒ Hash
Return the field error represented as a hash.
Constructor Details
#initialize(field_name, error_code, message = '') ⇒ Field
Returns a new instance of Field.
39 40 41 42 43 |
# File 'lib/gruf/errors/field.rb', line 39 def initialize(field_name, error_code, = '') @field_name = field_name @error_code = error_code @message = end |
Instance Attribute Details
#error_code ⇒ Object (readonly)
Returns the value of attribute error_code.
29 30 31 |
# File 'lib/gruf/errors/field.rb', line 29 def error_code @error_code end |
#field_name ⇒ Object (readonly)
Returns the value of attribute field_name.
26 27 28 |
# File 'lib/gruf/errors/field.rb', line 26 def field_name @field_name end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
32 33 34 |
# File 'lib/gruf/errors/field.rb', line 32 def @message end |
Instance Method Details
#to_h ⇒ Hash
Return the field error represented as a hash
50 51 52 53 54 55 56 |
# File 'lib/gruf/errors/field.rb', line 50 def to_h { field_name: field_name, error_code: error_code, message: } end |