Changeset 1283

Show
Ignore:
Timestamp:
03/06/08 15:42:19 (9 months ago)
Author:
sandal
Message:

Ruby 1.9 compatible FCSV formatter

Files:

Legend:

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

    r1214 r1283  
    1919  class Record    
    2020     
    21     private :id 
     21    if RUBY_VERSION < "1.9" 
     22      private :id      
     23    end 
    2224 
    2325    include Enumerable   
  • ruport/trunk/lib/ruport/formatter/csv.rb

    r1281 r1283  
    3131  # 
    3232  class Formatter::CSV < Formatter 
     33                        
     34    if RUBY_VERSION > "1.9"      
     35      require "csv" 
     36      FCSV = CSV 
     37      alias_method :FCSV, :CSV    
     38    end 
    3339     
    3440    renders :csv, :for => [ Renderer::Row,   Renderer::Table,  
    3541                            Renderer::Group, Renderer::Grouping ] 
     42     
     43    def initialize 
     44      require "fastercsv" unless RUBY_VERSION > "1.9"    
     45    end 
    3646 
    3747    attr_writer :csv_writer 
    38  
    39     def initialize 
    40       require 'fastercsv' 
    41     end 
    4248 
    4349    # Hook for setting available options using a template. See the template  
  • ruport/trunk/lib/ruport/renderer.rb

    r1262 r1283  
    2727  # Simplified version of HashWithIndifferentAccess 
    2828  class Options < OpenStruct  
    29      
    30     private :id 
     29            
     30    if RUBY_VERSION < "1.9" 
     31      private :id    
     32    end 
    3133     
    3234    # Returns a Hash object.  Use this if you need methods other than []