Class: ActiveStatus::Error

Inherits:
Object
  • Object
show all
Defined in:
lib/active_status/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, error, message = nil) ⇒ Error

Returns a new instance of Error.



5
6
7
8
9
# File 'lib/active_status/error.rb', line 5

def initialize(name, error, message = nil)
  @name    = name
  @error   = error
  @message = message
end

Instance Attribute Details

#errorObject

Returns the value of attribute error.



3
4
5
# File 'lib/active_status/error.rb', line 3

def error
  @error
end

#messageObject

Returns the value of attribute message.



3
4
5
# File 'lib/active_status/error.rb', line 3

def message
  @message
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/active_status/error.rb', line 3

def name
  @name
end

Instance Method Details

#as_json(_ = nil) ⇒ Object



11
12
13
14
15
16
# File 'lib/active_status/error.rb', line 11

def as_json(_ = nil)
  hash = { name: name, error: error }
  return hash unless ActiveStatus.config.verbose

  hash.merge({ message: message })
end