Exception: Exception

Defined in:
lib/brass.rb

Instance Method Summary collapse

Instance Method Details

#assertion?Boolean

Is the exception an assertion?

Returns:

  • (Boolean)


4
5
6
# File 'lib/brass.rb', line 4

def assertion?
  @assertion
end

#priorityObject

Exceptions can have priority levels.

Zero is a nominal error, the higher the priority the more severe the error is considered. Errors with priorities less than zero are taken be warnings, the lower the number the more trivial.



36
37
38
# File 'lib/brass.rb', line 36

def priority
  @priority ||= 0
end

#set_assertion(boolean) ⇒ Object

Set the the exception's assertion flag.



9
10
11
# File 'lib/brass.rb', line 9

def set_assertion(boolean)
  @assertion = boolean # ? true : false
end

#set_message(msg) ⇒ Object

TODO:

Does the message have to be a string?

Set message. (not strictly needed here, but can be useful anyway).



17
18
19
# File 'lib/brass.rb', line 17

def set_message(msg)
  @mesg = msg.to_str
end

#set_priority(level) ⇒ Object

Set priority level.

Parameters:

  • level (Integer)

    The priority level of the exception.



26
27
28
# File 'lib/brass.rb', line 26

def set_priority(level)
  @priority = level.to_i
end