Skip to content

Commit

Permalink
Remove ObectSpace dumping and start using inherited, it's faster.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordon Bedwell committed Jan 10, 2016
1 parent 88b970f commit 561414c
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions lib/jekyll/plugin.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
module Jekyll
class Plugin
PRIORITIES = { :lowest => -100,
:low => -10,
:normal => 0,
:high => 10,
:highest => 100 }
PRIORITIES = {
:low => -10,
:highest => 100,
:lowest => -100,
:normal => 0,
:high => 10
}

# Fetch all the subclasses of this class and its 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

def self.inherited(const)
const.define_singleton_method :inherited do |const_|
(@children ||= Set.new).merge [
const_
]
end
descendants
end

#

def self.descendants
@children || Set.new
end

# Get or set the priority of this plugin. When called without an
Expand Down

0 comments on commit 561414c

Please sign in to comment.