SystemExit

SystemExit (스크립트 종료 예외)

exit스크립트의 종료를 시작할 때 던져지는 예외예요. 단순히 종료 상태 코드와 메시지를 담기 위한 용도의 예외 클래스랍니다.

출처: Ruby 3.3 API

본문

new → system_exit

주어진 상태(status)와 메시지를 가진 SystemExit 예외를 새로 만들어요. 상태는 true, false, 또는 정수(integer)예요. 상태를 주지 않으면 true가 사용돼요.

SystemExit.new          # 상태 true
SystemExit.new(3)       # 상태 3
SystemExit.new(1, "msg") # 상태 1, 메시지 "msg"
SystemExit.new("msg")    # 메시지 "msg"

status → integer

이 시스템 종료와 연결된 상태 값을 돌려줘요.

success? → true or false

종료가 성공적이었으면 true를, 아니면 false를 돌려줘요.