Class: Fauna::Failure
- Inherits:
-
Object
- Object
- Fauna::Failure
- Defined in:
- lib/fauna/errors.rb
Overview
Part of ErrorData. For more information, see the docs.
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Failure code.
-
#description ⇒ Object
readonly
Failure description.
-
#field ⇒ Object
readonly
Field of the failure in the instance.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#initialize(code, description, field) ⇒ Failure
constructor
:nodoc:.
-
#inspect ⇒ Object
:nodoc:.
Constructor Details
#initialize(code, description, field) ⇒ Failure
:nodoc:
186 187 188 189 190 |
# File 'lib/fauna/errors.rb', line 186 def initialize(code, description, field) # :nodoc: @code = code @description = description @field = field end |
Instance Attribute Details
#code ⇒ Object (readonly)
Failure code.
172 173 174 |
# File 'lib/fauna/errors.rb', line 172 def code @code end |
#description ⇒ Object (readonly)
Failure description.
174 175 176 |
# File 'lib/fauna/errors.rb', line 174 def description @description end |
#field ⇒ Object (readonly)
Field of the failure in the instance.
176 177 178 |
# File 'lib/fauna/errors.rb', line 176 def field @field end |
Class Method Details
.from_hash(hash) ⇒ Object
:nodoc:
178 179 180 181 182 183 184 |
# File 'lib/fauna/errors.rb', line 178 def self.from_hash(hash) # :nodoc: Failure.new( ErrorHelpers.get_or_throw(hash, :code), ErrorHelpers.get_or_throw(hash, :description), ErrorHelpers.map_position(hash[:field]), ) end |
Instance Method Details
#inspect ⇒ Object
:nodoc:
192 193 194 |
# File 'lib/fauna/errors.rb', line 192 def inspect # :nodoc: "Failure(#{code.inspect}, #{description.inspect}, #{field.inspect})" end |