Exception: AlertMachine::RunTask::AssertionFailure

Inherits:
Exception
  • Object
show all
Defined in:
lib/run_task.rb

Overview

When an assertion fails, this exception is thrown so that we can unwind the stack frame. It’s also deliberately throwing something that’s not derived from Exception.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg, caller) ⇒ AssertionFailure

Returns a new instance of AssertionFailure.



101
102
103
104
# File 'lib/run_task.rb', line 101

def initialize(msg, caller)
  @msg, @caller, @time = msg, caller, Time.now
  super(@msg)
end

Instance Attribute Details

#callerObject (readonly)

Returns the value of attribute caller.



100
101
102
# File 'lib/run_task.rb', line 100

def caller
  @caller
end

#msgObject (readonly)

Returns the value of attribute msg.



100
101
102
# File 'lib/run_task.rb', line 100

def msg
  @msg
end

#timeObject (readonly)

Returns the value of attribute time.



100
101
102
# File 'lib/run_task.rb', line 100

def time
  @time
end

Instance Method Details

#logObject



106
107
108
109
# File 'lib/run_task.rb', line 106

def log
  "[#{Time.now}] #{msg ? msg + "\n" : ""}" +
    "#{Caller.new(caller).log}"
end

#parsed_callerObject



111
112
113
# File 'lib/run_task.rb', line 111

def parsed_caller
  Caller.new(caller)
end