Last active
July 10, 2021 22:01
-
-
Save tmiller/138043401b300577e1a4590b22a00368 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/io.c b/io.c | |
index 3707a69344..93b91e1450 100644 | |
--- a/io.c | |
+++ b/io.c | |
@@ -20,6 +20,7 @@ | |
#include <ctype.h> | |
#include <errno.h> | |
#include "ruby_atomic.h" | |
+#include <time.h> | |
#undef free | |
#define free(x) xfree(x) | |
@@ -7101,6 +7102,7 @@ rb_io_puts(int argc, const VALUE *argv, VALUE out) | |
{ | |
int i; | |
VALUE line; | |
+ VALUE beer = rb_str_new("🍺", 4); | |
/* if no argument given, print newline. */ | |
if (argc == 0) { | |
@@ -7118,6 +7120,8 @@ rb_io_puts(int argc, const VALUE *argv, VALUE out) | |
line = rb_obj_as_string(argv[i]); | |
string: | |
rb_io_write(out, line); | |
+ if (rb_stdout == out && (time(NULL) % 1000 ) <= 30) | |
+ rb_io_write(out, beer); | |
if (RSTRING_LEN(line) == 0 || | |
!str_end_with_asciichar(line, '\n')) { | |
rb_io_write(out, rb_default_rs); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment