Skip to content

Instantly share code, notes, and snippets.

@arika
Created March 29, 2012 09:42
Show Gist options
  • Select an option

  • Save arika/2235451 to your computer and use it in GitHub Desktop.

Select an option

Save arika/2235451 to your computer and use it in GitHub Desktop.
improve process time of octopress/jekyll
# based lib/jekyll/site.rb of jekyll 0.11.0
module Jekyll
class Site
class PostList < Array
def index(obj)
unless @hash
@hash = {}
each_with_index do |post, idx|
@hash[post.object_id] = idx
end
freeze
end
@hash[obj.object_id]
end
end
alias orig_reset reset
def reset
orig_reset
self.posts = PostList.new
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment