summaryrefslogtreecommitdiff
path: root/lib/coderay.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/coderay.rb')
-rw-r--r--lib/coderay.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/coderay.rb b/lib/coderay.rb
index c897220..63ec555 100644
--- a/lib/coderay.rb
+++ b/lib/coderay.rb
@@ -127,7 +127,18 @@ module CodeRay
$CODERAY_DEBUG ||= false
- require 'coderay/version'
+ # Assuming the rel_path is a subpath of lib/
+ def self.abs_path(rel_path)
+ File.join(File.dirname(__FILE__), rel_path)
+ end
+
+ # In order to work in environments that alter $:, we need to
+ # set the absolute path when autoloading files.
+ def self.autoload(const_name, rel_path)
+ super const_name, abs_path(rel_path)
+ end
+
+ require abs_path('coderay/version')
# helpers
autoload :FileType, 'coderay/helpers/file_type'