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
Constructor Details
#initialize(field_name, error_code, message = '') ⇒ Field
Returns a new instance of Field.
30 31 32 33 34 |
# File 'lib/gruf/errors/field.rb', line 30 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.
23 24 25 |
# File 'lib/gruf/errors/field.rb', line 23 def error_code @error_code end |
#field_name ⇒ Object (readonly)
Returns the value of attribute field_name.
23 24 25 |
# File 'lib/gruf/errors/field.rb', line 23 def field_name @field_name end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
23 24 25 |
# File 'lib/gruf/errors/field.rb', line 23 def @message end |
Instance Method Details
#to_h ⇒ Hash
39 40 41 42 43 44 45 |
# File 'lib/gruf/errors/field.rb', line 39 def to_h { field_name: field_name, error_code: error_code, message: } end |