summaryrefslogtreecommitdiff
path: root/lib/csv/table.rb
diff options
context:
space:
mode:
authorSutou Kouhei <kou@cozmixng.org>2019-10-12 14:03:21 +0900
committerGitHub <noreply@github.com>2019-10-12 14:03:21 +0900
commit92df7d98b62f48cf21cdec522f2e7b34380fd718 (patch)
treea0d169e177ebd5607caefa26cef90cc70df48232 /lib/csv/table.rb
parentd6e68bb263e79cb802fa683d9c4139ddca2fd4f5 (diff)
Import CSV 3.1.2 (#2547)
Notes
Notes: Merged-By: kou <kou@clear-code.com>
Diffstat (limited to 'lib/csv/table.rb')
-rw-r--r--lib/csv/table.rb54
1 files changed, 27 insertions, 27 deletions
diff --git a/lib/csv/table.rb b/lib/csv/table.rb
index 29b188a6d7..e6c1ee11fa 100644
--- a/lib/csv/table.rb
+++ b/lib/csv/table.rb
@@ -5,7 +5,7 @@ require "forwardable"
class CSV
#
# A CSV::Table is a two-dimensional data structure for representing CSV
- # documents. Tables allow you to work with the data by row or column,
+ # documents. Tables allow you to work with the data by row or column,
# manipulate the data, and even convert the results back to CSV, if needed.
#
# All tables returned by CSV will be constructed from this class, if header
@@ -13,8 +13,8 @@ class CSV
#
class Table
#
- # Construct a new CSV::Table from +array_of_rows+, which are expected
- # to be CSV::Row objects. All rows are assumed to have the same headers.
+ # Constructs a new CSV::Table from +array_of_rows+, which are expected
+ # to be CSV::Row objects. All rows are assumed to have the same headers.
#
# The optional +headers+ parameter can be set to Array of headers.
# If headers aren't set, headers are fetched from CSV::Row objects.
@@ -55,11 +55,11 @@ class CSV
def_delegators :@table, :empty?, :length, :size
#
- # Returns a duplicate table object, in column mode. This is handy for
+ # Returns a duplicate table object, in column mode. This is handy for
# chaining in a single call without changing the table mode, but be aware
# that this method can consume a fair amount of memory for bigger data sets.
#
- # This method returns the duplicate table for chaining. Don't chain
+ # This method returns the duplicate table for chaining. Don't chain
# destructive methods (like []=()) this way though, since you are working
# with a duplicate.
#
@@ -68,7 +68,7 @@ class CSV
end
#
- # Switches the mode of this table to column mode. All calls to indexing and
+ # Switches the mode of this table to column mode. All calls to indexing and
# iteration methods will work with columns until the mode is changed again.
#
# This method returns the table and is safe to chain.
@@ -80,7 +80,7 @@ class CSV
end
#
- # Returns a duplicate table object, in mixed mode. This is handy for
+ # Returns a duplicate table object, in mixed mode. This is handy for
# chaining in a single call without changing the table mode, but be aware
# that this method can consume a fair amount of memory for bigger data sets.
#
@@ -93,9 +93,9 @@ class CSV
end
#
- # Switches the mode of this table to mixed mode. All calls to indexing and
+ # Switches the mode of this table to mixed mode. All calls to indexing and
# iteration methods will use the default intelligent indexing system until
- # the mode is changed again. In mixed mode an index is assumed to be a row
+ # the mode is changed again. In mixed mode an index is assumed to be a row
# reference while anything else is assumed to be column access by headers.
#
# This method returns the table and is safe to chain.
@@ -120,7 +120,7 @@ class CSV
end
#
- # Switches the mode of this table to row mode. All calls to indexing and
+ # Switches the mode of this table to row mode. All calls to indexing and
# iteration methods will work with rows until the mode is changed again.
#
# This method returns the table and is safe to chain.
@@ -146,7 +146,7 @@ class CSV
#
# In the default mixed mode, this method returns rows for index access and
- # columns for header access. You can force the index association by first
+ # columns for header access. You can force the index association by first
# calling by_col!() or by_row!().
#
# Columns are returned as an Array of values. Altering that Array has no
@@ -163,18 +163,18 @@ class CSV
#
# In the default mixed mode, this method assigns rows for index access and
- # columns for header access. You can force the index association by first
+ # columns for header access. You can force the index association by first
# calling by_col!() or by_row!().
#
# Rows may be set to an Array of values (which will inherit the table's
# headers()) or a CSV::Row.
#
# Columns may be set to a single value, which is copied to each row of the
- # column, or an Array of values. Arrays of values are assigned to rows top
- # to bottom in row major order. Excess values are ignored and if the Array
+ # column, or an Array of values. Arrays of values are assigned to rows top
+ # to bottom in row major order. Excess values are ignored and if the Array
# does not have a value for each row the extra rows will receive a +nil+.
#
- # Assigning to an existing column or row clobbers the data. Assigning to
+ # Assigning to an existing column or row clobbers the data. Assigning to
# new columns creates them at the right end of the table.
#
def []=(index_or_header, value)
@@ -212,9 +212,9 @@ class CSV
#
# The mixed mode default is to treat a list of indices as row access,
- # returning the rows indicated. Anything else is considered columnar
- # access. For columnar access, the return set has an Array for each row
- # with the values indicated by the headers in each Array. You can force
+ # returning the rows indicated. Anything else is considered columnar
+ # access. For columnar access, the return set has an Array for each row
+ # with the values indicated by the headers in each Array. You can force
# column or row mode using by_col!() or by_row!().
#
# You cannot mix column and row access.
@@ -234,7 +234,7 @@ class CSV
end
#
- # Adds a new row to the bottom end of this table. You can provide an Array,
+ # Adds a new row to the bottom end of this table. You can provide an Array,
# which will be converted to a CSV::Row (inheriting the table's headers()),
# or a CSV::Row.
#
@@ -251,7 +251,7 @@ class CSV
end
#
- # A shortcut for appending multiple rows. Equivalent to:
+ # A shortcut for appending multiple rows. Equivalent to:
#
# rows.each { |row| self << row }
#
@@ -264,9 +264,9 @@ class CSV
end
#
- # Removes and returns the indicated columns or rows. In the default mixed
+ # Removes and returns the indicated columns or rows. In the default mixed
# mode indices refer to rows and everything else is assumed to be a column
- # headers. Use by_col!() or by_row!() to force the lookup.
+ # headers. Use by_col!() or by_row!() to force the lookup.
#
def delete(*indexes_or_headers)
if indexes_or_headers.empty?
@@ -293,9 +293,9 @@ class CSV
end
#
- # Removes any column or row for which the block returns +true+. In the
+ # Removes any column or row for which the block returns +true+. In the
# default mixed mode or row mode, iteration is the standard row major
- # walking of rows. In column mode, iteration will +yield+ two element
+ # walking of rows. In column mode, iteration will +yield+ two element
# tuples containing the column name and an Array of values for that column.
#
# This method returns the table for chaining.
@@ -321,7 +321,7 @@ class CSV
#
# In the default mixed mode or row mode, iteration is the standard row major
- # walking of rows. In column mode, iteration will +yield+ two element
+ # walking of rows. In column mode, iteration will +yield+ two element
# tuples containing the column name and an Array of values for that column.
#
# This method returns the table for chaining.
@@ -347,7 +347,7 @@ class CSV
end
#
- # Returns the table as an Array of Arrays. Headers will be the first row,
+ # Returns the table as an Array of Arrays. Headers will be the first row,
# then all of the field rows will follow.
#
def to_a
@@ -360,7 +360,7 @@ class CSV
end
#
- # Returns the table as a complete CSV String. Headers will be listed first,
+ # Returns the table as a complete CSV String. Headers will be listed first,
# then all of the field rows.
#
# This method assumes you want the Table.headers(), unless you explicitly