1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/date] Revert "Simplify #inspect"

This reverts commit af01edd7d8575f544f647dbe8cde5b6ae535d459.

Revert requested by Yui Naruse.

https://github.com/ruby/date/commit/875d563557
This commit is contained in:
Jeremy Evans 2019-10-26 18:20:46 -07:00 committed by Hiroshi SHIBATA
parent fce940aac7
commit 3895e548bd
2 changed files with 5 additions and 4 deletions

View file

@ -6574,8 +6574,11 @@ static VALUE
mk_inspect(union DateData *x, VALUE klass, VALUE to_s)
{
return rb_enc_sprintf(rb_usascii_encoding(),
"#<%"PRIsVALUE": %"PRIsVALUE">",
klass, to_s);
"#<%"PRIsVALUE": %"PRIsVALUE" "
"((%+"PRIsVALUE"j,%ds,%+"PRIsVALUE"n),%+ds,%.0fj)>",
klass, to_s,
m_real_jd(x), m_df(x), m_sf(x),
m_of(x), m_sg(x));
}
/*

View file

@ -282,10 +282,8 @@ class TestSH < Test::Unit::TestCase
def test_inspect
d = Date.new(2001, 2, 3)
assert_equal(Encoding::US_ASCII, d.inspect.encoding)
assert_equal('#<Date: 2001-02-03>', d.inspect)
d = DateTime.new(2001, 2, 3)
assert_equal(Encoding::US_ASCII, d.inspect.encoding)
assert_equal('#<DateTime: 2001-02-03T00:00:00+00:00>', d.inspect)
end
def test_strftime