From 21c7e102e672d69f50f658293563cd98734a0600 Mon Sep 17 00:00:00 2001 From: Rene Saarsoo Date: Mon, 1 Apr 2013 14:57:42 +0300 Subject: [PATCH] Fix double-loading of Tag::Tag class in Ruby 1.8. Ruby 1.8 doesn't understand that we have loaded this class already and will re-load it and then give warnings. --- lib/jsduck/tag_loader.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/jsduck/tag_loader.rb b/lib/jsduck/tag_loader.rb index f42ca71e..b0477eeb 100644 --- a/lib/jsduck/tag_loader.rb +++ b/lib/jsduck/tag_loader.rb @@ -24,7 +24,14 @@ module JsDuck # Loads tag classes from given dir or single file. def load(path) if File.directory?(path) - Dir[path+"/**/*.rb"].each {|file| require(file) } + Dir[path+"/**/*.rb"].each do |file| + # Ruby 1.8 doesn't understand that "jsduck/tag/tag" and + # "./lib/jsduck/tag/tag.rb" refer to the same file. So + # explicitly avoid loading this file (as it's required on + # top already) to prevent warnings of constants getting + # defined multiple times. + require(file) unless file =~ /jsduck\/tag\/tag\.rb$/ + end else require(path) end -- GitLab