Skip to content

Commit

Permalink
Add missing From_Ruby#is_convertible for Data_Object<T>
Browse files Browse the repository at this point in the history
  • Loading branch information
cfisoi committed Dec 9, 2024
1 parent ccd3ca4 commit 58f8d63
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions rice/Data_Object.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,18 @@ namespace Rice::detail
static_assert(!std::is_fundamental_v<intrinsic_type<T>>,
"Data_Object cannot be used with fundamental types");
public:
Convertible is_convertible(VALUE value)
{
switch (rb_type(value))
{
case RUBY_T_DATA:
return Data_Type<T>::is_descendant(value) ? Convertible::Exact : Convertible::None;
break;
default:
return Convertible::None;
}
}

static Data_Object<T> convert(VALUE value)
{
return Data_Object<T>(value);
Expand Down

0 comments on commit 58f8d63

Please sign in to comment.