Skip to content

Commit

Permalink
Save location for compiled dispatcher method
Browse files Browse the repository at this point in the history
  • Loading branch information
printercu committed Oct 16, 2015
1 parent 4498c37 commit 0e9774f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/temple/mixins/dispatcher.rb
Expand Up @@ -60,10 +60,12 @@ def replace_dispatcher(exp)
dispatched_methods.each do |method|
method.split('_'.freeze)[1..-1].inject(tree) {|node, type| node[type.to_sym] }.method = method
end
self.class.class_eval %{def dispatcher(exp)
return replace_dispatcher(exp) if self.class != #{self.class}
#{tree.compile.gsub("\n", "\n ")}
end}
self.class.class_eval <<-RUBY, __FILE__, __LINE__ + 1
def dispatcher(exp)
return replace_dispatcher(exp) if self.class != #{self.class}
#{tree.compile.gsub("\n", "\n ")}
end
RUBY
dispatcher(exp)
end

Expand Down

0 comments on commit 0e9774f

Please sign in to comment.