@@ -1673,41 +1673,59 @@ def initialize(data,
1673
1673
writer if @writer_options [ :write_headers ]
1674
1674
end
1675
1675
1676
+ # :call-seq:
1677
+ # csv.col_sep -> string
1678
+ #
1676
1679
# Returns the encoded column separator; used for parsing and writing;
1677
1680
# see {Option +col_sep+}[#class-CSV-label-Option+col_sep]:
1678
1681
# CSV.new('').col_sep # => ","
1679
1682
def col_sep
1680
1683
parser . column_separator
1681
1684
end
1682
1685
1686
+ # :call-seq:
1687
+ # csv.row_sep -> string
1688
+ #
1683
1689
# Returns the encoded row separator; used for parsing and writing;
1684
1690
# see {Option +row_sep+}[#class-CSV-label-Option+row_sep]:
1685
1691
# CSV.new('').row_sep # => "\n"
1686
1692
def row_sep
1687
1693
parser . row_separator
1688
1694
end
1689
1695
1696
+ # :call-seq:
1697
+ # csv.quote_char -> character
1698
+ #
1690
1699
# Returns the encoded quote character; used for parsing and writing;
1691
1700
# see {Option +quote_char+}[#class-CSV-label-Option+quote_char]:
1692
1701
# CSV.new('').quote_char # => "\""
1693
1702
def quote_char
1694
1703
parser . quote_character
1695
1704
end
1696
1705
1706
+ # :call-seq:
1707
+ # csv.field_size_limit -> integer or nil
1708
+ #
1697
1709
# Returns the limit for field size; used for parsing;
1698
1710
# see {Option +field_size_limit+}[#class-CSV-label-Option+field_size_limit]:
1699
1711
# CSV.new('').field_size_limit # => nil
1700
1712
def field_size_limit
1701
1713
parser . field_size_limit
1702
1714
end
1703
1715
1716
+ # :call-seq:
1717
+ # csv.skip_lines -> regexp or nil
1718
+ #
1704
1719
# Returns the \Regexp used to identify comment lines; used for parsing;
1705
1720
# see {Option +skip_lines+}[#class-CSV-label-Option+skip_lines]:
1706
1721
# CSV.new('').skip_lines # => nil
1707
1722
def skip_lines
1708
1723
parser . skip_lines
1709
1724
end
1710
1725
1726
+ # :call-seq:
1727
+ # csv.converters -> array
1728
+ #
1711
1729
# Returns an \Array containing field converters; used for parsing;
1712
1730
# see {Option +converters+}[#class-CSV-label-Option+converters]:
1713
1731
# CSV.new('').converters # => []
@@ -1718,6 +1736,9 @@ def converters
1718
1736
end
1719
1737
end
1720
1738
1739
+ # :call-seq:
1740
+ # csv.unconverted_fields? -> object
1741
+ #
1721
1742
# Returns the value that determines whether unconverted fields are to be
1722
1743
# available; used for parsing;
1723
1744
# see {Option +unconverted_fields+}[#class-CSV-label-Option+unconverted_fields]:
@@ -1726,6 +1747,9 @@ def unconverted_fields?
1726
1747
parser . unconverted_fields?
1727
1748
end
1728
1749
1750
+ # :call-seq:
1751
+ # csv.headers -> object
1752
+ #
1729
1753
# Returns the value that determines whether headers are used; used for parsing;
1730
1754
# see {Option +headers+}[#class-CSV-label-Option+headers]:
1731
1755
# CSV.new('').headers # => nil
@@ -1741,20 +1765,29 @@ def headers
1741
1765
end
1742
1766
end
1743
1767
1768
+ # :call-seq:
1769
+ # csv.return_headers? -> true or false
1770
+ #
1744
1771
# Returns the value that determines whether headers are to be returned; used for parsing;
1745
1772
# see {Option +return_headers+}[#class-CSV-label-Option+return_headers]:
1746
1773
# CSV.new('').return_headers? # => false
1747
1774
def return_headers?
1748
1775
parser . return_headers?
1749
1776
end
1750
1777
1778
+ # :call-seq:
1779
+ # csv.write_headers? -> true or false
1780
+ #
1751
1781
# Returns the value that determines whether headers are to be written; used for generating;
1752
1782
# see {Option +write_headers+}[#class-CSV-label-Option+write_headers]:
1753
1783
# CSV.new('').write_headers? # => nil
1754
1784
def write_headers?
1755
1785
@writer_options [ :write_headers ]
1756
1786
end
1757
1787
1788
+ # :call-seq:
1789
+ # csv.header_converters -> array
1790
+ #
1758
1791
# Returns an \Array containing header converters; used for parsing;
1759
1792
# see {Option +header_converters+}[#class-CSV-label-Option+header_converters]:
1760
1793
# CSV.new('').header_converters # => []
@@ -1765,13 +1798,19 @@ def header_converters
1765
1798
end
1766
1799
end
1767
1800
1801
+ # :call-seq:
1802
+ # csv.skip_blanks? -> true or false
1803
+ #
1768
1804
# Returns the value that determines whether blank lines are to be ignored; used for parsing;
1769
1805
# see {Option +skip_blanks+}[#class-CSV-label-Option+skip_blanks]:
1770
1806
# CSV.new('').skip_blanks? # => false
1771
1807
def skip_blanks?
1772
1808
parser . skip_blanks?
1773
1809
end
1774
1810
1811
+ # :call-seq:
1812
+ # csv.force_quotes? -> true or false
1813
+ #
1775
1814
# Returns the value that determines whether all output fields are to be quoted;
1776
1815
# used for generating;
1777
1816
# see {Option +force_quotes+}[#class-CSV-label-Option+force_quotes]:
@@ -1780,18 +1819,27 @@ def force_quotes?
1780
1819
@writer_options [ :force_quotes ]
1781
1820
end
1782
1821
1822
+ # :call-seq:
1823
+ # csv.liberal_parsing? -> true or false
1824
+ #
1783
1825
# Returns the value that determines whether illegal input is to be handled; used for parsing;
1784
1826
# see {Option +liberal_parsing+}[#class-CSV-label-Option+liberal_parsing]:
1785
1827
# CSV.new('').liberal_parsing? # => false
1786
1828
def liberal_parsing?
1787
1829
parser . liberal_parsing?
1788
1830
end
1789
1831
1832
+ # :call-seq:
1833
+ # csv.encoding -> endcoding
1834
+ #
1790
1835
# Returns the encoding used for parsing and generating;
1791
1836
# see {CSV and Character Encodings (M17n or Multilingualization)}[#class-CSV-label-CSV+and+Character+Encodings+-28M17n+or+Multilingualization-29]:
1792
1837
# CSV.new('').encoding # => #<Encoding:UTF-8>
1793
1838
attr_reader :encoding
1794
1839
1840
+ # :call-seq:
1841
+ # csv.line_no -> integer
1842
+ #
1795
1843
# Returns the count of the rows parsed or generated.
1796
1844
#
1797
1845
# Parsing:
@@ -1826,6 +1874,9 @@ def lineno
1826
1874
end
1827
1875
end
1828
1876
1877
+ # :call-seq:
1878
+ # csv.line -> array
1879
+ #
1829
1880
# Returns the line most recently read:
1830
1881
# string = "foo,0\nbar,1\nbaz,2\n"
1831
1882
# path = 't.csv'
0 commit comments