Class: Csv2hash::StructureValidator::MinColumns

Inherits:
Object
  • Object
show all
Includes:
Validator
Defined in:
lib/csv2hash/structure_validator/min_columns.rb

Instance Method Summary (collapse)

Methods included from Validator

#validate!

Constructor Details

- (MinColumns) initialize(min_size)

Returns a new instance of MinColumns



7
8
9
# File 'lib/csv2hash/structure_validator/min_columns.rb', line 7

def initialize min_size
  @min_size = min_size
end

Instance Method Details

- (Object) error_message(line)



15
16
17
# File 'lib/csv2hash/structure_validator/min_columns.rb', line 15

def error_message line
  "Not enough columns (min. #{@min_size}) on line #{line}"
end

- (Object) validate_line(line)



11
12
13
# File 'lib/csv2hash/structure_validator/min_columns.rb', line 11

def validate_line line
  line.size < @min_size
end