15 " def method_missing m, *a, &b\n" 16 " t = @@golf_hash[ [m,self.class] ] ||= matching_methods(m)[0]\n" 18 " __send__(t, *a) {|*args|\n" 19 " b.binding.eval(\"proc{|golf_matchdata| $~ = golf_matchdata }\").call($~) if $~\n" 23 " t ? __send__(t, *a, &b) : super\n" 27 " def matching_methods(s='', m=callable_methods)\n" 28 " r=/^#{s.to_s.gsub(/./){\"(.*?)\"+Regexp.escape($&)}}/\n" 29 " m.grep(r).sort_by do |i|\n" 30 " i.to_s.match(r).captures.map(&:size) << i\n" 34 " def self.const_missing c\n" 35 " t = @@golf_hash[ [c,self.class] ] ||= matching_methods(c,constants)[0]\n" 36 " t and return const_get(t)\n" 37 " raise NameError, \"uninitialized constant #{c}\", caller(1)\n" 40 " def shortest_abbreviation(s='', m=callable_methods)\n" 42 " our_case = (?A..?Z)===s[0]\n" 43 " if m.index(s.to_sym)\n" 44 " 1.upto(s.size){|z|s.scan(/./).combination(z).map{|trial|\n" 45 " next unless ((?A..?Z)===trial[0]) == our_case\n" 47 " return trial if matching_methods(trial,m)[0].to_s==s\n" 54 " def callable_methods\n" 55 " self.class == Object ? methods + private_methods : methods\n" 60 " def h(a='H', b='w', c='!')\n" 61 " puts \"#{a}ello, #{b}orld#{c}\"\n" 76 " alias old_to_s to_s\n" 81 " alias old_to_s to_s\n" 89 " include Enumerable\n" 99 " (Array.instance_methods-instance_methods-[:to_ary,:transpose,:flatten,:flatten!,:compact,:compact!,:assoc,:rassoc]).each{|meth|\n" 101 " def #{meth}(*args, &block)\n" 103 " result = a.#{meth}(*args, &block)\n" 105 " if result.class == Array\n" 106 " Integer===result[0] ? result.pack('c*') : result.join\n" 107 " elsif result.class == Enumerator\n" 108 " result.map(&:join).to_enum\n" 117 " alias old_to_s to_s\n" 118 " (Array.instance_methods-instance_methods-[:replace]+[:to_s]).each{|meth|\n" 120 " def #{meth}(*args, &block)\n" 121 " to_a.#{meth}(*args, &block)\n" 124 " alias old_inspect inspect\n" 125 " alias inspect old_to_s\n" 129 " def call(*args, &block)\n" 131 " recv.__send__(self, *args, &block)\n" 137 #define PRELUDE_COUNT 0 static void prelude_eval(VALUE code, VALUE name, VALUE line)
VALUE rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE filepath, VALUE line, VALUE opt)
static const char prelude_name0[]
VALUE rb_iseq_eval(VALUE iseqval)
static const char prelude_code0[]
VALUE rb_usascii_str_new(const char *, long)