Class: DocktorRails::Result
- Inherits:
-
Struct
- Object
- Struct
- DocktorRails::Result
- Defined in:
- lib/docktor_rails/result.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
Returns the value of attribute files.
-
#hint ⇒ Object
Returns the value of attribute hint.
-
#id ⇒ Object
Returns the value of attribute id.
-
#message ⇒ Object
Returns the value of attribute message.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
Instance Attribute Details
#files ⇒ Object
Returns the value of attribute files
4 5 6 |
# File 'lib/docktor_rails/result.rb', line 4 def files @files end |
#hint ⇒ Object
Returns the value of attribute hint
4 5 6 |
# File 'lib/docktor_rails/result.rb', line 4 def hint @hint end |
#id ⇒ Object
Returns the value of attribute id
4 5 6 |
# File 'lib/docktor_rails/result.rb', line 4 def id @id end |
#message ⇒ Object
Returns the value of attribute message
4 5 6 |
# File 'lib/docktor_rails/result.rb', line 4 def @message end |
#status ⇒ Object
Returns the value of attribute status
4 5 6 |
# File 'lib/docktor_rails/result.rb', line 4 def status @status end |
Instance Method Details
#fail? ⇒ Boolean
25 26 27 |
# File 'lib/docktor_rails/result.rb', line 25 def fail? status == :fail end |
#pass? ⇒ Boolean
17 18 19 |
# File 'lib/docktor_rails/result.rb', line 17 def pass? status == :pass end |
#to_h ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/docktor_rails/result.rb', line 5 def to_h h = { id: id, status: status.to_s, message: , files: Array(files).compact } h[:hint] = hint if hint h.delete(:files) if h[:files].empty? h end |
#warn? ⇒ Boolean
21 22 23 |
# File 'lib/docktor_rails/result.rb', line 21 def warn? status == :warn end |