summaryrefslogtreecommitdiff
path: root/jni/ruby/sample/trick2013/yhara
diff options
context:
space:
mode:
authorJari Vetoniemi <jari.vetoniemi@indooratlas.com>2020-03-16 18:49:26 +0900
committerJari Vetoniemi <jari.vetoniemi@indooratlas.com>2020-03-30 00:39:06 +0900
commitfcbf63e62c627deae76c1b8cb8c0876c536ed811 (patch)
tree64cb17de3f41a2b6fef2368028fbd00349946994 /jni/ruby/sample/trick2013/yhara
Fresh start
Diffstat (limited to 'jni/ruby/sample/trick2013/yhara')
-rw-r--r--jni/ruby/sample/trick2013/yhara/authors.markdown3
-rw-r--r--jni/ruby/sample/trick2013/yhara/entry.rb28
-rw-r--r--jni/ruby/sample/trick2013/yhara/remarks.en.markdown23
-rw-r--r--jni/ruby/sample/trick2013/yhara/remarks.markdown24
4 files changed, 78 insertions, 0 deletions
diff --git a/jni/ruby/sample/trick2013/yhara/authors.markdown b/jni/ruby/sample/trick2013/yhara/authors.markdown
new file mode 100644
index 0000000..c0adc2b
--- /dev/null
+++ b/jni/ruby/sample/trick2013/yhara/authors.markdown
@@ -0,0 +1,3 @@
+* Yutaka Hara
+ * yutaka.hara.gmail.com
+ * cctld: jp
diff --git a/jni/ruby/sample/trick2013/yhara/entry.rb b/jni/ruby/sample/trick2013/yhara/entry.rb
new file mode 100644
index 0000000..a2deb54
--- /dev/null
+++ b/jni/ruby/sample/trick2013/yhara/entry.rb
@@ -0,0 +1,28 @@
+def _(&b)$><<->(x){x ? (String===x ?x.upcase:
+(Class===x ? x : x.class).name[$a?0:($a=5)]):
+" "}[ begin b[];rescue Exception;$!;end ] end
+
+_ { return }
+_ { method(:p).unbind }
+_ { eval "{ " }
+_ { Thread.current.join }
+_ { nil }
+_ { select }
+_ { ruby }
+_ { self.class }
+_ { Thread.current.group }
+_ { nil.to_h }
+_ { "\xFF".encode("big5") }
+_ { raise }
+_ { [0][1] }
+_ { Regexp.compile "*" }
+_ { RUBY_COPYRIGHT[32] }
+_ { binding }
+_ { :s.class.name[1] }
+_ { warn }
+_ { [a: :b][0] }
+_ { methods }
+_ { IO.class }
+_ { {}.fetch(0) }
+_ { open " " }
+_ { 1000000.chr }
diff --git a/jni/ruby/sample/trick2013/yhara/remarks.en.markdown b/jni/ruby/sample/trick2013/yhara/remarks.en.markdown
new file mode 100644
index 0000000..bd821e8
--- /dev/null
+++ b/jni/ruby/sample/trick2013/yhara/remarks.en.markdown
@@ -0,0 +1,23 @@
+### Remarks
+
+Just run it with no argument:
+
+ ruby entry.rb
+
+I confirmed the following implementations/platforms:
+
+* ruby 2.0.0p0 (2013-02-24 revision 39474) [x86\_64-darwin12.2.1]
+
+### Description
+
+It prints JUST ANOTHER RUBY HACKER¡£
+
+### Internals
+
+This script uses characters in constants in Object class. It
+intentionally raises some exceptions. The second 'U' comes from
+RUBY\_COPYRIGHT, "Yukihiro Matsumoto".
+
+### Limitation
+
+This program does not work on JRuby because "return" does not raise an exception.
diff --git a/jni/ruby/sample/trick2013/yhara/remarks.markdown b/jni/ruby/sample/trick2013/yhara/remarks.markdown
new file mode 100644
index 0000000..99cb4b5
--- /dev/null
+++ b/jni/ruby/sample/trick2013/yhara/remarks.markdown
@@ -0,0 +1,24 @@
+### Remarks
+
+引数ãªã—ã§æ™®é€šã«å®Ÿè¡Œã—ã¦ãã ã•ã„。
+
+ ruby entry.rb
+
+以下ã®å®Ÿè£…・プラットフォームã§å‹•ä½œç¢ºèªã—ã¦ã„ã¾ã™ã€‚
+
+* ruby 2.0.0p0 (2013-02-24 revision 39474) [x86\_64-darwin12.2.1]
+
+### Description
+
+JUST ANOTHER RUBY HACKERã¨è¡¨ç¤ºã—ã¾ã™ã€‚
+
+### Internals
+
+Objectクラスã®å®šæ•°ã‹ã‚‰æ–‡å­—を拾ã£ã¦ã„ã¾ã™ã€‚
+ãã®ãŸã‚ã«ã€æ„図的ã«ä¾‹å¤–ã‚’èµ·ã“ã—ã¦ã„ã¾ã™ã€‚
+「Uã€ãŒä¸€ã¤ã—ã‹è¦‹ã¤ã‹ã‚‰ãªã‹ã£ãŸã®ã§ã€ã‚‚ã†ä¸€å€‹ã¯RUBY\_COPYRIGHTã®
+「Yukihiro Matsumotoã€ã‹ã‚‰å–ã£ã¦ã„ã¾ã™ã€‚
+
+### Limitation
+
+JRubyã¯returnãŒã‚¨ãƒ©ãƒ¼ã«ãªã‚‰ãªãã¦ã€å‹•ãã¾ã›ã‚“ã§ã—ãŸã€‚