summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSaku Ytti <saku@ytti.fi>2014-07-03 17:21:47 +0300
committerSaku Ytti <saku@ytti.fi>2014-07-03 17:21:47 +0300
commitc8b9e5af6d38e73ffa830c7abc137021447cb6bc (patch)
tree4df9b143a1a99a7f114c141691624d289ad3f3f3 /lib
parent646794b7f1aca52914d76e95b4601d4b868c7217 (diff)
Fix class name resolution
In new method, where we no long explicitly set loaded class name for later resolution we depend on file name being same as class name. However for File output, this is not true, because I didn't want plain File in code to resolve to Oxidized::File, and din't want to always write ::File, File ouput has class name OxFile. This change allows class names to start optionally with string 'Oxidized' if so, they still match.
Diffstat (limited to 'lib')
-rw-r--r--lib/oxidized/manager.rb1
-rw-r--r--lib/oxidized/output/file.rb2
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/oxidized/manager.rb b/lib/oxidized/manager.rb
index ed49b7e..251f0cc 100644
--- a/lib/oxidized/manager.rb
+++ b/lib/oxidized/manager.rb
@@ -11,6 +11,7 @@ module Oxidized
klass = nil
[Oxidized, Object].each do |mod|
klass = mod.constants.find { |const| const.to_s.downcase == file.downcase }
+ klass = mod.constants.find { |const| const.to_s.downcase == 'oxidized'+ file.downcase } unless klass
klass = mod.const_get klass if klass
break if klass
end
diff --git a/lib/oxidized/output/file.rb b/lib/oxidized/output/file.rb
index f3443b4..2d08106 100644
--- a/lib/oxidized/output/file.rb
+++ b/lib/oxidized/output/file.rb
@@ -1,5 +1,5 @@
module Oxidized
-class OxFile < Output
+class OxidizedFile < Output
require 'fileutils'
def initialize