Skip to content

Commit f1ddd69

Browse files
committed
* golf_prelude.rb (Object.const_missing): Auto-complete constants.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 3b83e10 commit f1ddd69

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Fri Dec 28 10:06:54 2007 Akinori MUSHA <knu@iDaemons.org>
2+
3+
* golf_prelude.rb (Object.const_missing): Auto-complete constants.
4+
15
Fri Dec 28 01:55:04 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
26

37
* transcode.c (transcode_dispatch): allows transcoding from/to

golf_prelude.rb

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ def method_missing m, *a, &b
55
t ? __send__(t, *a, &b) : super
66
end
77

8+
def self.const_missing c
9+
r = /^#{c}/
10+
t = constants.sort.find{|e|r=~e}
11+
t ? const_get(t) : superclass.const_get(c)
12+
end
13+
814
def h(a='H', b='w', c='!')
915
puts "#{a}ello, #{b}orld#{c}"
1016
end

0 commit comments

Comments
 (0)