Add new function mrb_ensure_hash_type(); ref #4097

Unlike `mrb_check_hash_type()` that returns `nil` if the argument is
not a `Hash`, `mrb_ensure_hash_type()` raises a `TypeError` exception.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2018-08-30 22:14:10 +09:00
parent e471d37ca5
commit f6564dd83e
2 changed files with 8 additions and 1 deletions
+1
View File
@@ -25,6 +25,7 @@ struct RHash {
#define mrb_hash_value(p) mrb_obj_value((void*)(p))
MRB_API mrb_value mrb_hash_new_capa(mrb_state*, mrb_int);
MRB_API mrb_value mrb_ensure_hash_type(mrb_state *mrb, mrb_value hash);
MRB_API mrb_value mrb_check_hash_type(mrb_state *mrb, mrb_value hash);
/*