Exception: Muwu::ProjectExceptionHandler::Fatal

Inherits:
StandardError
  • Object
show all
Defined in:
lib/muwu/project_exception_handler/fatal.rb

Instance Method Summary collapse

Constructor Details

#initialize(exceptions) ⇒ Fatal

Returns a new instance of Fatal.



6
7
8
9
10
# File 'lib/muwu/project_exception_handler/fatal.rb', line 6

def initialize(exceptions)
  @exceptions = [exceptions].flatten
  render_exceptions
  exit
end

Instance Method Details

#render_exception(exception) ⇒ Object



13
14
15
16
# File 'lib/muwu/project_exception_handler/fatal.rb', line 13

def render_exception(exception)
  $stderr.puts "- #{exception.class}"
  $stderr.puts "  #{exception.report}"
end

#render_exceptionsObject



19
20
21
22
23
24
25
# File 'lib/muwu/project_exception_handler/fatal.rb', line 19

def render_exceptions
  render_header
  @exceptions.each do |exception|
    render_exception(exception)
  end
  render_lf
end

#render_headerObject



28
29
30
# File 'lib/muwu/project_exception_handler/fatal.rb', line 28

def render_header
  $stderr.puts "#{self.inspect}"
end

#render_lfObject



33
34
35
# File 'lib/muwu/project_exception_handler/fatal.rb', line 33

def render_lf
  $stderr.puts "\n"
end