Cast comparisons
Dieser Commit ist enthalten in:
Ursprung
565e175f79
Commit
06e618ecbe
2 geänderte Dateien mit 29 neuen und 2 gelöschten Zeilen
|
@ -155,6 +155,16 @@
|
|||
color: $primary;
|
||||
}
|
||||
}
|
||||
|
||||
.select-kit-header .selected-name {
|
||||
max-width: 85%;
|
||||
|
||||
.name {
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.mapper-pairs {
|
||||
|
|
|
@ -85,8 +85,11 @@ class CustomWizard::Mapper
|
|||
key = map_field(pair['key'], pair['key_type'])
|
||||
connector = pair['connector']
|
||||
operator = map_operator(connector)
|
||||
value = interpolate(map_field(pair['value'], pair['value_type']))
|
||||
value = Regexp.new(value) if connector == 'regex'
|
||||
value = cast_value(
|
||||
key,
|
||||
interpolate(map_field(pair['value'], pair['value_type'])),
|
||||
connector
|
||||
)
|
||||
|
||||
begin
|
||||
failed = !cast_result(key.public_send(operator, value), connector)
|
||||
|
@ -98,6 +101,20 @@ class CustomWizard::Mapper
|
|||
!failed
|
||||
end
|
||||
|
||||
def cast_value(key, value, connector)
|
||||
if connector == 'regex'
|
||||
Regexp.new(value)
|
||||
else
|
||||
if key.is_a?(String)
|
||||
value.to_s
|
||||
elsif key.is_a?(Integer)
|
||||
value.to_i
|
||||
else
|
||||
value
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def cast_result(result, connector)
|
||||
if connector == 'regex'
|
||||
result == 0 ? true : false
|
||||
|
|
Laden …
In neuem Issue referenzieren