From 70ecef0094e561326c12814968413715ad7e98d2 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Sun, 10 Nov 2013 21:04:19 -0600 Subject: [PATCH] Sort methods from most important to least important This idea is based on the concept of a newspaper. The most important things such as the headlines and the major details of the story at the top. This translates to code in that the public API and the more important private methods are at the top of the file. The more detailed information (or methods, in the code) are further down, so that if you've gotten all you need out of the code up to a certain point, you don't need to keep reading anymore. --- lib/jekyll/layout_reader.rb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/jekyll/layout_reader.rb b/lib/jekyll/layout_reader.rb index b09a75ca..6181e47e 100644 --- a/lib/jekyll/layout_reader.rb +++ b/lib/jekyll/layout_reader.rb @@ -15,10 +15,6 @@ class LayoutReader private - def layout_directory - File.join(site.source, site.config['layouts']) - end - def layout_entries entries = [] with(layout_directory) do @@ -27,13 +23,18 @@ class LayoutReader entries end - def with(directory) - return unless File.exists?(directory) - Dir.chdir(directory) { yield directory } - end - def layout_name(file) file.split(".")[0..-2].join(".") end + def with(directory) + return unless File.exists?(directory) + Dir.chdir(directory) { yield } + end + + def layout_directory + File.join(site.source, site.config['layouts']) + end + + end