Skip to content

Commit

Permalink
dispatcher: better error message
Browse files Browse the repository at this point in the history
  • Loading branch information
minad committed Dec 6, 2011
1 parent 03ac3f7 commit 3d6c098
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/temple/mixins/dispatcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ def replace_dispatcher(exp)
next if method.to_s !~ /^on_(.*)$/
method_types = $1.split('_')
(0...method_types.size).inject(types) do |tmp, i|
raise "Invalid temple dispatcher #{method}" unless Hash === tmp
unless Hash === tmp
conflict = method_types[0...i].join('_')
raise "Temple dispatcher '#{method}' conflicts with 'on_#{conflict}'"
end
if i == method_types.size - 1
tmp[method_types[i]] = method
else
Expand Down

0 comments on commit 3d6c098

Please sign in to comment.