lib/valigator/csv/error.rb in valigator-csv-1.4.1 vs lib/valigator/csv/error.rb in valigator-csv-1.5.0
- old
+ new
@@ -8,11 +8,11 @@
end
class Error
- attr_reader :row, :type, :message, :field
+ attr_reader :row, :type, :message, :field, :details
def initialize(error)
case error
@@ -24,30 +24,31 @@
end
def ==(other)
- row == other.row && message == other.message && type == other.type && field == other.field
+ row == other.row && message == other.message && type == other.type && field == other.field && details == other.details
end
def to_hash
{
row: row,
type: type,
message: message,
- field: field
+ field: field,
+ details: details
}
end
private
def build_from_hash(error)
- build error[:type], error[:message], error[:row], error[:field]
+ build error[:type], error[:message], error[:row], error[:field], error[:details]
end
def build_from_error(error)
@@ -61,14 +62,15 @@
matches[:lineno].to_i if matches
end
- def build(type, message, row, field=nil)
+ def build(type, message, row, field = nil, details = nil)
@type = type
@row = row
@message = message
@field = field
+ @details = details
end
def map_to_type(message)