Project

General

Profile

Bug #4469 ยป fix_camel_case_method_names.patch

Patch to fix the problem - agrimm (Andrew Grimm), 03/05/2011 09:53 PM

View differences:

class.c
988 988
 *  <i>obj</i>'s ancestors.
989 989
 *
990 990
 *     class Klass
991
 *       def kMethod()
991
 *       def klass_method()
992 992
 *       end
993 993
 *     end
994 994
 *     k = Klass.new
995
 *     k.methods[0..9]    #=> [:kMethod, :freeze, :nil?, :is_a?,
996
 *                        #    :class, :instance_variable_set,
997
 *                        #    :methods, :extend, :__send__, :instance_eval]
998
 *     k.methods.length   #=> 42
995
 *     k.methods[0..9]    #=> [:klass_method, :nil?, :===,
996
 *                        #    :==~, :!, :eql?
997
 *                        #    :hash, :<=>, :class, :singleton_class]
998
 *     k.methods.length   #=> 57
999 999
 */
1000 1000

  
1001 1001
VALUE
marshal.c
876 876
 *       def initialize(str)
877 877
 *         @str = str
878 878
 *       end
879
 *       def sayHello
879
 *       def say_hello
880 880
 *         @str
881 881
 *       end
882 882
 *     end
......
886 886
 *     o = Klass.new("hello\n")
887 887
 *     data = Marshal.dump(o)
888 888
 *     obj = Marshal.load(data)
889
 *     obj.sayHello   #=> "hello\n"
889
 *     obj.say_hello  #=> "hello\n"
890 890
 *
891 891
 * Marshal can't dump following objects:
892 892
 * * anonymous Class/Module.
proc.c
336 336
 *  calling +eval+ to execute the evaluated command in this
337 337
 *  environment. Also see the description of class +Binding+.
338 338
 *
339
 *     def getBinding(param)
339
 *     def get_binding(param)
340 340
 *       return binding
341 341
 *     end
342
 *     b = getBinding("hello")
342
 *     b = get_binding("hello")
343 343
 *     eval("param", b)   #=> "hello"
344 344
 */
345 345

  
......
358 358
 *  <em>lineno</em> parameters are present, they will be used when
359 359
 *  reporting syntax errors.
360 360
 *
361
 *     def getBinding(param)
361
 *     def get_binding(param)
362 362
 *       return binding
363 363
 *     end
364
 *     b = getBinding("hello")
364
 *     b = get_binding("hello")
365 365
 *     b.eval("param")   #=> "hello"
366 366
 */
367 367

  
......
2211 2211
 *       def initialize(n)
2212 2212
 *         @secret = n
2213 2213
 *       end
2214
 *       def getBinding
2214
 *       def get_binding
2215 2215
 *         return binding()
2216 2216
 *       end
2217 2217
 *     end
2218 2218
 *
2219 2219
 *     k1 = Demo.new(99)
2220
 *     b1 = k1.getBinding
2220
 *     b1 = k1.get_binding
2221 2221
 *     k2 = Demo.new(-3)
2222
 *     b2 = k2.getBinding
2222
 *     b2 = k2.get_binding
2223 2223
 *
2224 2224
 *     eval("@secret", b1)   #=> 99
2225 2225
 *     eval("@secret", b2)   #=> -3
sample/biorhythm.rb
29 29
require "optparse"
30 30
require "optparse/date"
31 31

  
32
def printHeader(y, m, d, p, w)
32
def print_header(y, m, d, p, w)
33 33
  print "\n>>> Biorhythm <<<\n"
34 34
  printf "The birthday %04d.%02d.%02d is a %s\n", y, m, d, w
35 35
  printf "Age in days: [%d]\n\n", p
36 36
end
37 37

  
38
def getPosition(z)
38
def get_position(z)
39 39
  pi = Math::PI
40 40
  z = Integer(z)
41 41
  phys = (50.0 * (1.0 + sin((z / 23.0 - (z / 23)) * 360.0 * pi / 180.0))).to_i
......
89 89
display_period = options[:days]
90 90

  
91 91
if ausgabeart == "v"
92
  printHeader(bd.year, bd.month, bd.day, dd - bd, bd.strftime("%a"))
92
  print_header(bd.year, bd.month, bd.day, dd - bd, bd.strftime("%a"))
93 93
  print "\n"
94 94
  
95
  phys, emot, geist = getPosition(dd - bd)
95
  phys, emot, geist = get_position(dd - bd)
96 96
  printf "Biorhythm:   %04d.%02d.%02d\n", dd.year, dd.month, dd.day
97 97
  printf "Physical:    %d%%\n", phys
98 98
  printf "Emotional:   %d%%\n", emot
99 99
  printf "Mental:      %d%%\n", geist
100 100
  print "\n"
101 101
else
102
  printHeader(bd.year, bd.month, bd.day, dd - bd, bd.strftime("%a"))
102
  print_header(bd.year, bd.month, bd.day, dd - bd, bd.strftime("%a"))
103 103
  print "                     P=physical, E=emotional, M=mental\n"
104 104
  print "             -------------------------+-------------------------\n"
105 105
  print "                     Bad Condition    |    Good Condition\n"
106 106
  print "             -------------------------+-------------------------\n"
107 107
  
108 108
  (dd - bd).step(dd - bd + display_period) do |z|
109
    phys, emot, geist = getPosition(z)
109
    phys, emot, geist = get_position(z)
110 110
    
111 111
    printf "%04d.%02d.%02d : ", dd.year, dd.month, dd.day
112 112
    p = (phys / 2.0 + 0.5).to_i
vm_eval.c
459 459
 *  values.
460 460
 *
461 461
 *     class Roman
462
 *       def romanToInt(str)
462
 *       def roman_to_int(str)
463 463
 *         # ...
464 464
 *       end
465 465
 *       def method_missing(methId)
466 466
 *         str = methId.id2name
467
 *         romanToInt(str)
467
 *         roman_to_int(str)
468 468
 *       end
469 469
 *     end
470 470
 *
......
1082 1082
 *  optional <em>filename</em> and <em>lineno</em> parameters are
1083 1083
 *  present, they will be used when reporting syntax errors.
1084 1084
 *
1085
 *     def getBinding(str)
1085
 *     def get_binding(str)
1086 1086
 *       return binding
1087 1087
 *     end
1088 1088
 *     str = "hello"
1089 1089
 *     eval "str + ' Fred'"                      #=> "hello Fred"
1090
 *     eval "str + ' Fred'", getBinding("bye")   #=> "bye Fred"
1090
 *     eval "str + ' Fred'", get_binding("bye")  #=> "bye Fred"
1091 1091
 */
1092 1092

  
1093 1093
VALUE
vm_method.c
1152 1152
 *     end
1153 1153
 *     class Cls
1154 1154
 *       include Mod
1155
 *       def callOne
1155
 *       def call_one
1156 1156
 *         one
1157 1157
 *       end
1158 1158
 *     end
1159 1159
 *     Mod.one     #=> "This is one"
1160 1160
 *     c = Cls.new
1161
 *     c.callOne   #=> "This is one"
1161
 *     c.call_one  #=> "This is one"
1162 1162
 *     module Mod
1163 1163
 *       def one
1164 1164
 *         "This is the new one"
1165 1165
 *       end
1166 1166
 *     end
1167 1167
 *     Mod.one     #=> "This is one"
1168
 *     c.callOne   #=> "This is the new one"
1168
 *     c.call_one  #=> "This is the new one"
1169 1169
 */
1170 1170

  
1171 1171
static VALUE