Support MRB_WIHTOUT_FLOAT to mruby-kernel-ext
MODIFY
mrbgems/mruby-kernel-ext/src/kernel.c
mrbgems/mruby-kernel-ext/src/kernel.c
@@ -114,6 +114,7 @@ mrb_f_integer(mrb_state *mrb, mrb_value self)
return mrb_convert_to_integer(mrb, arg, base);
}
+#ifndef MRB_WITHOUT_FLOAT
/*
* call-seq:
* Float(arg) -> float
@@ -134,6 +135,7 @@ mrb_f_float(mrb_state *mrb, mrb_value self)
mrb_get_args(mrb, "o", &arg);
return mrb_Float(mrb, arg);
}
+#endif
/*
* call-seq:
@@ -231,7 +233,9 @@ mrb_mruby_kernel_ext_gem_init(mrb_state *mrb)
mrb_define_module_function(mrb, krn, "caller", mrb_f_caller, MRB_ARGS_OPT(2));
mrb_define_method(mrb, krn, "__method__", mrb_f_method, MRB_ARGS_NONE());
mrb_define_module_function(mrb, krn, "Integer", mrb_f_integer, MRB_ARGS_ANY());
+#ifndef MRB_WITHOUT_FLOAT
mrb_define_module_function(mrb, krn, "Float", mrb_f_float, MRB_ARGS_REQ(1));
+#endif
mrb_define_module_function(mrb, krn, "String", mrb_f_string, MRB_ARGS_REQ(1));
mrb_define_module_function(mrb, krn, "Array", mrb_f_array, MRB_ARGS_REQ(1));
mrb_define_module_function(mrb, krn, "Hash", mrb_f_hash, MRB_ARGS_REQ(1));

MODIFY
mrbgems/mruby-kernel-ext/test/kernel.rb
mrbgems/mruby-kernel-ext/test/kernel.rb
@@ -49,7 +49,7 @@ assert('Kernel#__method__') do
end
assert('Kernel#Integer') do
- assert_equal(123, Integer(123.999))
+ assert_equal(123, Integer(123.999)) if class_defined?("Float")
assert_equal(26, Integer("0x1a"))
assert_equal(930, Integer("0930", 10))
assert_equal(7, Integer("111", 2))
@@ -63,7 +63,7 @@ assert('Kernel#Float') do
assert_equal(123.456, Float(123.456))
assert_equal(123.456, Float("123.456"))
assert_raise(TypeError) { Float(nil) }
-end
+end if class_defined?("Float")
assert('Kernel#String') do
assert_equal("main", String(self))

Support MRB_WIHTOUT_FLOAT to mruby-kernel-ext