lib/rouge.rb in rouge-4.0.1 vs lib/rouge.rb in rouge-4.1.0

- old
+ new

@@ -45,14 +45,12 @@ # Load the lexers in the `lib/rouge/lexers` directory. # # @api private def load_lexers - # The trailing slash is necessary to avoid lexers being loaded multiple - # times by `Lexers.load_lexer` - lexer_dir = File.join(LIB_DIR, "rouge/lexers/") - Dir.glob(File.join(lexer_dir, '*.rb')).each do |f| - Lexers.load_lexer(f.sub(lexer_dir, '')) + lexer_dir = Pathname.new(LIB_DIR) / "rouge/lexers" + Pathname.glob(lexer_dir / '*.rb').each do |f| + Lexers.load_lexer(f.relative_path_from(lexer_dir)) end end end end