Class: Csv2hash::StructureValidator::MaxColumns

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

Instance Method Summary (collapse)

Methods included from Validator

#validate!

Constructor Details

- (MaxColumns) initialize(max_size)

Returns a new instance of MaxColumns



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

def initialize max_size
  @max_size = max_size
end

Instance Method Details

- (Object) error_message(line)



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

def error_message line
  "Too many columns (max. #{@max_size}) on line #{line}"
end

- (Object) validate_line(line)



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

def validate_line line
  line.size > @max_size
end