Changeset 1259

Show
Ignore:
Timestamp:
02/04/08 02:41:20 (10 months ago)
Author:
brian
Message:

Name the arguments to render() and build()

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • ruport/trunk/lib/ruport/renderer.rb

    r1258 r1259  
    331331    # Please see the examples/ directory for custom renderer examples, because 
    332332    # this is not nearly as complicated as it sounds in most cases. 
    333     def render(*args
    334       rend = build(*args) { |r|         
     333    def render(format, add_options=nil
     334      rend = build(format, add_options) { |r| 
    335335          yield(r) if block_given?    
    336336        r.setup if r.respond_to? :setup 
     
    362362    # Returns the renderer instance. 
    363363    # 
    364     def build(*args
     364    def build(format, add_options=nil
    365365      rend = self.new 
    366366 
    367       rend.send(:use_formatter,args[0]
     367      rend.send(:use_formatter, format
    368368      rend.send(:options=, options.dup) 
    369369      if rend.class.const_defined? :Helpers 
    370370        rend.formatter.extend(rend.class.const_get(:Helpers)) 
    371371      end 
    372       if args[1].kind_of?(Hash) 
    373         d = args[1].delete(:data) 
     372      if add_options.kind_of?(Hash) 
     373        d = add_options.delete(:data) 
    374374        rend.data = d if d 
    375         args[1].each {|k,v| rend.options.send("#{k}=",v) } 
     375        add_options.each {|k,v| rend.options.send("#{k}=",v) } 
    376376      end 
    377377