diff --git a/lib/jekyll/plugin.rb b/lib/jekyll/plugin.rb index 2613f70d..94c0b28e 100644 --- a/lib/jekyll/plugin.rb +++ b/lib/jekyll/plugin.rb @@ -6,22 +6,15 @@ module Jekyll :high => 10, :highest => 100 } - # Install a hook so that subclasses are recorded. This method is only - # ever called by Ruby itself. + # Fetch all the subclasses of this class and its subclasses' subclasses. # - # base - The Class subclass. - # - # Returns nothing. - def self.inherited(base) - subclasses << base - subclasses.sort! - end - - # The list of Classes that have been subclassed. - # - # Returns an Array of Class objects. - def self.subclasses - @subclasses ||= [] + # Returns an array of descendant classes. + def self.descendants + descendants = [] + ObjectSpace.each_object(singleton_class) do |k| + descendants.unshift k unless k == self + end + descendants end # Get or set the priority of this plugin. When called without an diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 648fad6c..288662a5 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -365,7 +365,7 @@ module Jekyll # # Returns array of instances of subclasses of parameter def instantiate_subclasses(klass) - klass.subclasses.select do |c| + klass.descendants.select do |c| !safe || c.safe end.sort.map do |c| c.new(config) diff --git a/test/test_sass.rb b/test/test_sass.rb index b03b1137..102815a0 100644 --- a/test/test_sass.rb +++ b/test/test_sass.rb @@ -14,5 +14,13 @@ class TestSass < Test::Unit::TestCase should "import SCSS partial" do assert_equal ".half {\n width: 50%; }\n", File.read(@test_css_file) end + + should "register the SCSS converter" do + assert !!@site.getConverterImpl(Jekyll::Converters::Scss), "SCSS converter implementation should exist." + end + + should "register the Sass converter" do + assert !!@site.getConverterImpl(Jekyll::Converters::Sass), "Sass converter implementation should exist." + end end end