Class: Valigator::CSV::RowValidators::Ragged

Inherits:
Object
  • Object
show all
Defined in:
lib/valigator/csv/row_validators/ragged.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Ragged

Returns a new instance of Ragged.



9
10
11
# File 'lib/valigator/csv/row_validators/ragged.rb', line 9

def initialize(options = {})
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/valigator/csv/row_validators/ragged.rb', line 5

def options
  @options
end

Instance Method Details

#==(other) ⇒ Object



35
36
37
# File 'lib/valigator/csv/row_validators/ragged.rb', line 35

def ==(other)
  self.class == other.class && options == other.options
end

#error_messageObject



29
30
31
# File 'lib/valigator/csv/row_validators/ragged.rb', line 29

def error_message
  'Ragged or empty row'
end

#error_typeObject



23
24
25
# File 'lib/valigator/csv/row_validators/ragged.rb', line 23

def error_type
  'ragged_row'
end

#valid?(row) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
18
19
# File 'lib/valigator/csv/row_validators/ragged.rb', line 15

def valid?(row)
  return true unless fields

  row.size >= fields.size
end