Skip to content

Commit

Permalink
don't crash on non-number / string objects
Browse files Browse the repository at this point in the history
  • Loading branch information
nudded committed Dec 6, 2024
1 parent 624daa1 commit 2709a43
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions expression-ruby/ext/lago_expression/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::collections::HashMap;
use expression_core::{Event, Expression, ExpressionParser, ExpressionValue, PropertyValue};
use magnus::{
error, function, method, r_hash::ForEach, value::ReprValue, Error, IntoValue, Module, Object,
RHash, Ruby, TryConvert, Value,
RHash, Ruby, Value,
};

#[magnus::wrap(class = "Lago::Expression", free_immediately, size)]
Expand All @@ -25,8 +25,6 @@ impl EventWrapper {
.parse()
.expect("Failed to parse a number as bigdecimal");
PropertyValue::Number(big_d)
} else if value.is_kind_of(ruby.class_string()) {
PropertyValue::String(String::try_convert(value)?)
} else {
PropertyValue::String(value.to_string())
};
Expand Down

0 comments on commit 2709a43

Please sign in to comment.