summaryrefslogtreecommitdiff
path: root/golf_prelude.rb
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-28 02:18:05 (GMT)
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-28 02:18:05 (GMT)
commitec12be85744493b78b6fc6ca299b10350a2592a1 (patch)
tree5c7b607e91899b50f693fb626b7e48f3cf59e109 /golf_prelude.rb
parentf1ddd69d7bb8fa6af0f4306edea238fa97a2e941 (diff)
* golf_prelude.rb (Object.quine): get the script itself.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'golf_prelude.rb')
-rw-r--r--golf_prelude.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/golf_prelude.rb b/golf_prelude.rb
index 59b5ffc..18b9f1b 100644
--- a/golf_prelude.rb
+++ b/golf_prelude.rb
@@ -1,3 +1,5 @@
+SCRIPT_LINES__={}
+
class Object
def method_missing m, *a, &b
r = /^#{m}/
@@ -14,6 +16,10 @@ class Object
def h(a='H', b='w', c='!')
puts "#{a}ello, #{b}orld#{c}"
end
+
+ def quine(src = $0)
+ SCRIPT_LINES__[src]
+ end
end
class Integer