# File lib/ramaze/view/erector.rb, line 85 def self.call action, string # Return the contents unless a view has been defined return string, 'text/html' unless action.view # Evaluate the class so we can use it. The content of "string" # is a full blown class that should always have a "content" method. #eval string, action.binding eval string # Generate the class name based on the filename. # Class names are a CamelCased version of the filename (without the # extension). klass = File.basename action.view, '.erector' klass = klass.camel_case view_obj = self.const_get(klass) # Synchronize the methods of action.instance with the view. These # methods can be accessed by calling @controller.METHOD action.variables[:controller] = action.instance # Now that we have all the data we can start rendering the HTML. # Note that we pass the action.variables hash to the new() method. This # is done to give the view access to all existing (instance) variables. # Syncing them using action.copy_variables didn't seem to do the trick. html = view_obj.new(action.variables).to_html # All done return html, 'text/html' end