File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -321,11 +321,29 @@ def cells
321321 def rows ( skip = 0 )
322322 nc = num_cols
323323 result = ( ( 1 + skip ) ..num_rows ) . map do |row |
324- ( 1 ..nc ) . map { |col | self [ row , col ] } . freeze
324+ ( 1 ..nc ) . map do |col |
325+ block_given? ? yield ( row , col ) : self [ row , col ]
326+ end . freeze
325327 end
326328 result . freeze
327329 end
328330
331+ # Same as +#rows+, but replacing cells with numeric values where they exist
332+ #
333+ # @see #rows
334+ # @see #numeric_value
335+ def rows_with_numerics ( skip = 0 )
336+ rows ( skip ) { |row , col | numeric_value ( row , col ) || self [ row , col ] }
337+ end
338+
339+ # Same as +#rows, but with input values instead
340+ #
341+ # @see #rows
342+ # @see #input_value
343+ def rows_with_inputs ( skip = 0 )
344+ rows ( skip ) { |row , col | input_value ( row , col ) }
345+ end
346+
329347 # Inserts rows.
330348 #
331349 # e.g.
You can’t perform that action at this time.
0 commit comments