Skip to content

Commit

Permalink
* golf_prelude.rb (Object.quine): get the script itself.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
unak committed Dec 28, 2007
1 parent f1ddd69 commit ec12be8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Fri Dec 28 11:16:53 2007 NAKAMURA Usaku <[email protected]>

* golf_prelude.rb (Object.quine): get the script itself.

Fri Dec 28 10:06:54 2007 Akinori MUSHA <[email protected]>

* golf_prelude.rb (Object.const_missing): Auto-complete constants.
Expand Down
6 changes: 6 additions & 0 deletions golf_prelude.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
SCRIPT_LINES__={}

class Object
def method_missing m, *a, &b
r = /^#{m}/
Expand All @@ -14,6 +16,10 @@ def self.const_missing c
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
Expand Down

0 comments on commit ec12be8

Please sign in to comment.