faster_csv.rb.patch

Patch that doesn't work - Sven Müller, 2011-09-09 15:42

Download (2.58 KB)

View differences:

lib/faster_csv.rb (working copy)
796 796
  }
797 797
  
798 798
  # 
799 799
  # The options used when no overrides are given by calling code.  They are:
800 800
  # 
801
  # <b><tt>:col_sep</tt></b>::            <tt>","</tt>
801
  # <b><tt>:col_sep</tt></b>::            <tt>";"</tt>
802 802
  # <b><tt>:row_sep</tt></b>::            <tt>:auto</tt>
803 803
  # <b><tt>:quote_char</tt></b>::         <tt>'"'</tt>
804 804
  # <b><tt>:converters</tt></b>::         +nil+
805 805
  # <b><tt>:unconverted_fields</tt></b>:: +nil+
806 806
  # <b><tt>:headers</tt></b>::            +false+
807 807
  # <b><tt>:return_headers</tt></b>::     +false+
808 808
  # <b><tt>:header_converters</tt></b>::  +nil+
809 809
  # <b><tt>:skip_blanks</tt></b>::        +false+
810 810
  # <b><tt>:force_quotes</tt></b>::       +false+
811 811
  # 
812
  DEFAULT_OPTIONS = { :col_sep            => ",",
812
  DEFAULT_OPTIONS = { :col_sep            => ";",
813 813
                      :row_sep            => :auto,
814 814
                      :quote_char         => '"', 
815 815
                      :converters         => nil,
816 816
                      :unconverted_fields => nil,
817 817
                      :headers            => false,
......
851 851
    Object.const_set(:CSV, Class.new).class_eval do
852 852
      def self.foreach(path, rs = :auto, &block)  # :nodoc:
853 853
        FasterCSV.foreach(path, :row_sep => rs, &block)
854 854
      end
855 855
      
856
      def self.generate_line(row, fs = ",", rs = "")  # :nodoc:
856
      def self.generate_line(row, fs = ";", rs = "")  # :nodoc:
857 857
        FasterCSV.generate_line(row, :col_sep => fs, :row_sep => rs)
858 858
      end
859 859
      
860
      def self.open(path, mode, fs = ",", rs = :auto, &block)  # :nodoc:
860
      def self.open(path, mode, fs = ";", rs = :auto, &block)  # :nodoc:
861 861
        if block and mode.include? "r"
862 862
          FasterCSV.open(path, mode, :col_sep => fs, :row_sep => rs) do |csv|
863 863
            csv.each(&block)
864 864
          end
865 865
        else
866 866
          FasterCSV.open(path, mode, :col_sep => fs, :row_sep => rs, &block)
867 867
        end
868 868
      end
869 869
      
870
      def self.parse(str_or_readable, fs = ",", rs = :auto, &block)  # :nodoc:
870
      def self.parse(str_or_readable, fs = ";", rs = :auto, &block)  # :nodoc:
871 871
        FasterCSV.parse(str_or_readable, :col_sep => fs, :row_sep => rs, &block)
872 872
      end
873 873
      
874
      def self.parse_line(src, fs = ",", rs = :auto)  # :nodoc:
874
      def self.parse_line(src, fs = ";", rs = :auto)  # :nodoc:
875 875
        FasterCSV.parse_line(src, :col_sep => fs, :row_sep => rs)
876 876
      end
877 877
      
878 878
      def self.readlines(path, rs = :auto)  # :nodoc:
879 879
        FasterCSV.readlines(path, :row_sep => rs)