Class: Valigator::CSV::Error

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error) ⇒ Error



17
18
19
20
21
22
23
24
# File 'lib/valigator/csv/error.rb', line 17

def initialize(error)
  case error
    when Hash
      build_from_hash error
    when StandardError
      build_from_error error
  end
end

Instance Attribute Details

#detailsObject (readonly)

Returns the value of attribute details.



13
14
15
# File 'lib/valigator/csv/error.rb', line 13

def details
  @details
end

#fieldObject (readonly)

Returns the value of attribute field.



13
14
15
# File 'lib/valigator/csv/error.rb', line 13

def field
  @field
end

#messageObject (readonly)

Returns the value of attribute message.



13
14
15
# File 'lib/valigator/csv/error.rb', line 13

def message
  @message
end

#rowObject (readonly)

Returns the value of attribute row.



13
14
15
# File 'lib/valigator/csv/error.rb', line 13

def row
  @row
end

#typeObject (readonly)

Returns the value of attribute type.



13
14
15
# File 'lib/valigator/csv/error.rb', line 13

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



28
29
30
# File 'lib/valigator/csv/error.rb', line 28

def ==(other)
  row == other.row && message == other.message && type == other.type && field == other.field && details == other.details
end

#to_hashObject



34
35
36
37
38
39
40
41
42
# File 'lib/valigator/csv/error.rb', line 34

def to_hash
  {
    row: row,
    type: type,
    message: message,
    field: field,
    details: details
  }
end