Module: RubyFriendlyError
- Defined in:
- lib/ruby_friendly_error.rb,
lib/ruby_friendly_error/utils.rb,
lib/ruby_friendly_error/version.rb
Defined Under Namespace
Modules: Renderers
Classes: Utils
Constant Summary
collapse
- ROOT_PATH =
Pathname.new(__FILE__).dirname.parent.to_s
- WINDOW =
ENV['RUBY_FRIENDLY_ERROR_WINDOW']&.to_i || 2
- DISPLAY_START =
'<' * 80
- DISPLAY_END =
'>' * 80
- VERSION =
'0.0.3'
Class Method Summary
collapse
Class Method Details
.exec(file_content, file_name = '(eval)', lang = :en) ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/ruby_friendly_error.rb', line 42
def exec file_content, file_name = '(eval)', lang = :en
load_i18n lang
eval file_content, nil, file_name, 1 rescue Exception => exception renderer_class = renderer_class(exception)
raise exception unless renderer_class
renderer_class.new(exception, file_content).render
exit false
end
|
.load(file_path, lang = :en) ⇒ Object
38
39
40
|
# File 'lib/ruby_friendly_error.rb', line 38
def load file_path, lang = :en
exec File.read(file_path), File.expand_path(file_path), lang
end
|