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.
This commit is contained in:
parent
c5b81d580b
commit
70ecef0094
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue