summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-12 11:43:14 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-12 11:43:14 +0000
commitc1534d206dd32d4ea6bb9a32c85f4bea2f5552ec (patch)
treefb890367830735791cd68a7763f6e973de44e66b /ext
parent90fc1ef779adee01058e2f508cf1fca5e17e34dd (diff)
Revise Date#hour, #min, #sec
For ActiveSupport. [ruby-core:90443] [Bug #15403] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/date/date_core.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/date/date_core.c b/ext/date/date_core.c
index c51f9d4ad3..e61d952cbf 100644
--- a/ext/date/date_core.c
+++ b/ext/date/date_core.c
@@ -9032,6 +9032,12 @@ mk_ary_of_str(long len, const char *a[])
return o;
}
+static VALUE
+d_lite_zero(VALUE x)
+{
+ return INT2FIX(0);
+}
+
void
Init_date_core(void)
{
@@ -9374,6 +9380,12 @@ Init_date_core(void)
rb_define_method(cDate, "nth_kday?", d_lite_nth_kday_p, 2);
#endif
+ rb_define_private_method(cDate, "hour", d_lite_zero, 0);
+ rb_define_private_method(cDate, "min", d_lite_zero, 0);
+ rb_define_private_method(cDate, "minute", d_lite_zero, 0);
+ rb_define_private_method(cDate, "sec", d_lite_zero, 0);
+ rb_define_private_method(cDate, "second", d_lite_zero, 0);
+
rb_define_method(cDate, "julian?", d_lite_julian_p, 0);
rb_define_method(cDate, "gregorian?", d_lite_gregorian_p, 0);
rb_define_method(cDate, "leap?", d_lite_leap_p, 0);