module Kernel

Monkey patch kernel to ensure that all ‘require` calls call the same method

Public Instance Methods

load(file, wrap = false) click to toggle source
# File syntax_suggest/core_ext.rb, line 78
def load(file, wrap = false)
  syntax_suggest_original_load(file)
rescue SyntaxError => e
  require "syntax_suggest/api" unless defined?(SyntaxSuggest::DEFAULT_VALUE)

  SyntaxSuggest.handle_error(e)
end
Also aliased as: syntax_suggest_original_load
require(file) click to toggle source
# File syntax_suggest/core_ext.rb, line 86
def require(file)
  syntax_suggest_original_require(file)
rescue SyntaxError => e
  require "syntax_suggest/api" unless defined?(SyntaxSuggest::DEFAULT_VALUE)

  SyntaxSuggest.handle_error(e)
end
require_relative(file) click to toggle source
# File syntax_suggest/core_ext.rb, line 94
def require_relative(file)
  if Pathname.new(file).absolute?
    syntax_suggest_original_require file
  else
    relative_from = caller_locations(1..1).first
    relative_from_path = relative_from.absolute_path || relative_from.path
    syntax_suggest_original_require File.expand_path("../#{file}", relative_from_path)
  end
rescue SyntaxError => e
  require "syntax_suggest/api" unless defined?(SyntaxSuggest::DEFAULT_VALUE)

  SyntaxSuggest.handle_error(e)
end
syntax_suggest_original_load(file, wrap = false)
Alias for: load
syntax_suggest_original_require(file)
Alias for: require
syntax_suggest_original_require_relative(file)
Alias for: require_relative