Class: Reading::BlankRow

Inherits:
Row show all
Defined in:
lib/reading/row/blank_row.rb

Overview

An empty or commented-out row. A null object which returns an empty array.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Row

#initialize

Constructor Details

This class inherits a constructor from Reading::Row

Class Method Details

.match?(line) ⇒ Boolean

Whether the given CSV line is a blank row.

Parameters:

Returns:

  • (Boolean)


11
12
13
14
15
16
# File 'lib/reading/row/blank_row.rb', line 11

def self.match?(line)
  comment_char = line.csv.config.deep_fetch(:csv, :comment_character)

  line.string.strip.empty? ||
    line.string.strip.start_with?(comment_char)
end

Instance Method Details

#parseObject

Overrides Row#parse.



19
20
21
# File 'lib/reading/row/blank_row.rb', line 19

def parse
  []
end