require 'rubygems'
require 'mustache'

class HandleBar < Mustache
  def respond_to?(methodname)
    methodname = methodname.to_s.split(':').first
    super methodname
  end
  
  def method_missing(methodname, *args)
    methodname, args = methodname.to_s.split(/:\s*/)
    args = [args].flatten.join.split(/,\s*/)
    send methodname, *args
  end
  
  def wax_me *args
    "you've been waxed! #{args.reverse.join(', ')}"
  end
end

if $0 == __FILE__
  h = HandleBar.new
  h.template = "Mustache doesn't do arguments you say?\n\n{{wax_me: foo, bar, baz}}"
  puts h.to_html
end