0
0
Fork 0

cleaned up the commit a bit more

This commit is contained in:
Gibheer 2012-11-23 21:28:05 +01:00
parent 9e062519ba
commit 0fd7035a88
1 changed files with 11 additions and 8 deletions

View File

@ -55,14 +55,10 @@ module Zero
# the wanted template.
def read_template_path!
@templates = Hash.new do |hash, key|
subtree = {}
search_files(key).each do |file|
parts = file.split('.')
read_type(parts[2]).each do |type|
subtree[type] = file
end
end
hash[key] = subtree
# TODO this is just ugly
result = []
search_files(key).each { |file| fill_template_type_map(result, file) }
Hash[result]
end
self
end
@ -73,6 +69,13 @@ module Zero
Dir[template_path + template_name + '**/*.*']
end
def fill_template_type_map(dataset, file)
parts = file.split('.')
read_type(parts[2]).each do |type|
dataset << [type, file]
end
end
def read_type(short_notation)
to_type_list(type_map[short_notation] || short_notation)
end