#---
# Excerpted from "The ThoughtWorks Anthology",
# published by The Pragmatic Bookshelf.
# Copyrights apply to this code. It may not be used to create training material, 
# courses, books, articles, and the like. Contact us if you are in doubt.
# We make no guarantees that this code is fit for any purpose. 
# Visit http://www.pragmaticprogrammer.com/titles/twa for more book information.
#---
<%

require 'robustBuilder1'

def run aString
  builder = RulesBuilder1.new
  builder.instance_eval(aString)
rescue Exception
  puts  aString, '-- yields --'
  diag = Diagnostic.new($!, aString)
  puts diag
end

%>
====================================================================
forgetting the : on :camera

% run "item(camera).uses(electricity(1))"

note here that this limits our ability to give good diagnostics. We
might be able to say that only a symbol should appear as an argument
of item, but we can only detect that we got a unknown message, not
where in the DSL it originated. 

====================================================================

adding an extra argument to a resource method

% run "item(:camera).uses(electricity(1,1))"

Here we use just use the regular exception. Wrapped with the line
number it gives a reasonable error message. I don't think we can
intercept this one in the way that we could for method missing case we had earlier.
