diff options
author | Gibheer <gibheer@gmail.com> | 2012-11-23 21:28:05 +0100 |
---|---|---|
committer | Gibheer <gibheer@gmail.com> | 2012-11-26 21:41:09 +0100 |
commit | 0fd7035a886320a9ec7c11bfd643a99b163944b1 (patch) | |
tree | 07bf333b305d2929ac047ac0ce928e5d5ac336fd /lib | |
parent | 9e062519bae4fa85ef10c942be5e0e07b23aba50 (diff) |
cleaned up the commit a bit more
Diffstat (limited to 'lib')
-rw-r--r-- | lib/zero/renderer.rb | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/zero/renderer.rb b/lib/zero/renderer.rb index 3e9f790..31a6e27 100644 --- a/lib/zero/renderer.rb +++ b/lib/zero/renderer.rb @@ -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 |