Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use qualified method name for calls to Kernel#load #1503

Merged
merged 4 commits into from Apr 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/rougify
Expand Up @@ -3,8 +3,8 @@

require 'pathname'
ROOT_DIR = Pathname.new(__FILE__).dirname.parent
load ROOT_DIR.join('lib/rouge.rb')
load ROOT_DIR.join('lib/rouge/cli.rb')
Kernel::load ROOT_DIR.join('lib/rouge.rb')
Kernel::load ROOT_DIR.join('lib/rouge/cli.rb')
Signal.trap('PIPE', 'SYSTEM_DEFAULT') if Signal.list.include? 'PIPE'

begin
Expand Down
6 changes: 3 additions & 3 deletions lib/rouge.rb
Expand Up @@ -12,8 +12,8 @@ module Rouge

class << self
def reload!
Object.send :remove_const, :Rouge
load __FILE__
Object::send :remove_const, :Rouge
Kernel::load __FILE__
end

# Highlight some text with a given lexer and formatter.
Expand All @@ -40,7 +40,7 @@ def highlight(text, lexer, formatter, &b)
#
# @api private
def load_file(path)
load File.join(LIB_DIR, "rouge/#{path}.rb")
Kernel::load File.join(LIB_DIR, "rouge/#{path}.rb")
end

# Load the lexers in the `lib/rouge/lexers` directory.
Expand Down
2 changes: 1 addition & 1 deletion lib/rouge/lexer.rb
Expand Up @@ -511,7 +511,7 @@ module Lexers
def self.load_lexer(relpath)
return if @_loaded_lexers.key?(relpath)
@_loaded_lexers[relpath] = true
load File.join(BASE_DIR, relpath)
Kernel::load File.join(BASE_DIR, relpath)
end
end
end
2 changes: 1 addition & 1 deletion lib/rouge/lexers/apache.rb
Expand Up @@ -13,7 +13,7 @@ class Apache < RegexLexer

# self-modifying method that loads the keywords file
def self.keywords
load File.join(Lexers::BASE_DIR, 'apache/keywords.rb')
Kernel::load File.join(Lexers::BASE_DIR, 'apache/keywords.rb')
keywords
end

Expand Down
2 changes: 1 addition & 1 deletion lib/rouge/lexers/gherkin.rb
Expand Up @@ -19,7 +19,7 @@ def self.detect?(text)

# self-modifying method that loads the keywords file
def self.keywords
load File.join(Lexers::BASE_DIR, 'gherkin/keywords.rb')
Kernel::load File.join(Lexers::BASE_DIR, 'gherkin/keywords.rb')
keywords
end

Expand Down
2 changes: 1 addition & 1 deletion lib/rouge/lexers/isbl.rb
Expand Up @@ -10,7 +10,7 @@ class ISBL < RegexLexer
filenames '*.isbl'

def self.builtins
load File.join(Lexers::BASE_DIR, 'isbl/builtins.rb')
Kernel::load File.join(Lexers::BASE_DIR, 'isbl/builtins.rb')
self.builtins
end

Expand Down
2 changes: 1 addition & 1 deletion lib/rouge/lexers/lasso.rb
Expand Up @@ -36,7 +36,7 @@ def start_inline?

# self-modifying method that loads the keywords file
def self.keywords
load File.join(Lexers::BASE_DIR, 'lasso/keywords.rb')
Kernel::load File.join(Lexers::BASE_DIR, 'lasso/keywords.rb')
keywords
end

Expand Down
2 changes: 1 addition & 1 deletion lib/rouge/lexers/lua.rb
Expand Up @@ -25,7 +25,7 @@ def self.detect?(text)
end

def self.builtins
load File.join(Lexers::BASE_DIR, 'lua/builtins.rb')
Kernel::load File.join(Lexers::BASE_DIR, 'lua/builtins.rb')
self.builtins
end

Expand Down
2 changes: 1 addition & 1 deletion lib/rouge/lexers/mathematica.rb
Expand Up @@ -56,7 +56,7 @@ def self.keywords

# The list of built-in symbols comes from a wolfram server and is created automatically by rake
def self.builtins
load File.join(Lexers::BASE_DIR, 'mathematica/builtins.rb')
Kernel::load File.join(Lexers::BASE_DIR, 'mathematica/builtins.rb')
self.builtins
end

Expand Down
2 changes: 1 addition & 1 deletion lib/rouge/lexers/matlab.rb
Expand Up @@ -20,7 +20,7 @@ def self.keywords

# self-modifying method that loads the builtins file
def self.builtins
load File.join(Lexers::BASE_DIR, 'matlab/builtins.rb')
Kernel::load File.join(Lexers::BASE_DIR, 'matlab/builtins.rb')
builtins
end

Expand Down
2 changes: 1 addition & 1 deletion lib/rouge/lexers/php.rb
Expand Up @@ -29,7 +29,7 @@ def initialize(*)
end

def self.builtins
load File.join(Lexers::BASE_DIR, 'php/builtins.rb')
Kernel::load File.join(Lexers::BASE_DIR, 'php/builtins.rb')
self.builtins
end

Expand Down
2 changes: 1 addition & 1 deletion lib/rouge/lexers/sqf.rb
Expand Up @@ -55,7 +55,7 @@ def self.diag_commands
end

def self.commands
load File.join(Lexers::BASE_DIR, "sqf/commands.rb")
Kernel::load File.join(Lexers::BASE_DIR, "sqf/commands.rb")
@commands = self.commands
end

Expand Down
2 changes: 1 addition & 1 deletion lib/rouge/lexers/viml.rb
Expand Up @@ -14,7 +14,7 @@ class VimL < RegexLexer
mimetypes 'text/x-vim'

def self.keywords
load File.join(Lexers::BASE_DIR, 'viml/keywords.rb')
Kernel::load File.join(Lexers::BASE_DIR, 'viml/keywords.rb')
self.keywords
end

Expand Down
3 changes: 1 addition & 2 deletions spec/visual/app.rb
Expand Up @@ -18,8 +18,7 @@ class VisualTestApp < Sinatra::Application
DEMOS = ROOT.join('lib/rouge/demos')

def reload_source!
Object.send :remove_const, :Rouge
load ROUGE_LIB
Rouge.reload!
end

def query_string
Expand Down