Class: FactPulse::Helpers::ValidationErrorDetail
- Inherits:
-
Object
- Object
- FactPulse::Helpers::ValidationErrorDetail
- Defined in:
- lib/factpulse/helpers/exceptions.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#item ⇒ Object
Returns the value of attribute item.
-
#level ⇒ Object
Returns the value of attribute level.
-
#reason ⇒ Object
Returns the value of attribute reason.
-
#source ⇒ Object
Returns the value of attribute source.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(level: '', item: '', reason: '', source: nil, code: nil) ⇒ ValidationErrorDetail
constructor
A new instance of ValidationErrorDetail.
- #to_s ⇒ Object
Constructor Details
#initialize(level: '', item: '', reason: '', source: nil, code: nil) ⇒ ValidationErrorDetail
Returns a new instance of ValidationErrorDetail.
12 |
# File 'lib/factpulse/helpers/exceptions.rb', line 12 def initialize(level: '', item: '', reason: '', source: nil, code: nil); @level, @item, @reason, @source, @code = level, item, reason, source, code; end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
11 12 13 |
# File 'lib/factpulse/helpers/exceptions.rb', line 11 def code @code end |
#item ⇒ Object
Returns the value of attribute item.
11 12 13 |
# File 'lib/factpulse/helpers/exceptions.rb', line 11 def item @item end |
#level ⇒ Object
Returns the value of attribute level.
11 12 13 |
# File 'lib/factpulse/helpers/exceptions.rb', line 11 def level @level end |
#reason ⇒ Object
Returns the value of attribute reason.
11 12 13 |
# File 'lib/factpulse/helpers/exceptions.rb', line 11 def reason @reason end |
#source ⇒ Object
Returns the value of attribute source.
11 12 13 |
# File 'lib/factpulse/helpers/exceptions.rb', line 11 def source @source end |
Class Method Details
.from_hash(h) ⇒ Object
14 |
# File 'lib/factpulse/helpers/exceptions.rb', line 14 def self.from_hash(h); new(level: h['level']||'', item: h['item']||'', reason: h['reason']||'', source: h['source'], code: h['code']); end |
Instance Method Details
#to_s ⇒ Object
13 |
# File 'lib/factpulse/helpers/exceptions.rb', line 13 def to_s; "[#{@item.to_s.empty? ? 'unknown' : @item}] #{@reason.to_s.empty? ? 'Unknown error' : @reason}"; end |