Module: Checkup::ErrorsHelper

Included in:
Errors
Defined in:
lib/checkup/errors.rb

Overview

when included, automatically creates new Exceptions depending on the Const passed in

Instance Method Summary collapse

Instance Method Details

#const_missing(const) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/checkup/errors.rb', line 4

def const_missing(const)
  if const.to_s.end_with?('Error')
    module_eval("class #{const} < Checkup::Errors::Error; end")
  else
    module_eval("module #{const}; extend Checkup::ErrorsHelper; end")
  end
  const_get(const)
end