ruby-changes:18995
From: naruse <ko1@a...>
Date: Sun, 6 Mar 2011 05:29:03 +0900 (JST)
Subject: [ruby-changes:18995] Ruby:r31031 (trunk): * class.c: fix camelCase to snake_case in documentation code examples.
naruse 2011-03-06 05:25:08 +0900 (Sun, 06 Mar 2011) New Revision: 31031 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=31031 Log: * class.c: fix camelCase to snake_case in documentation code examples. patched by Andrew Grimm. fixes Bug #4469 * marshal.c: ditto. * proc.c: ditto. * sample/biorhythm.rb: ditto. * vm_eval.c: ditto. * vm_method.c: ditto. Modified files: trunk/ChangeLog trunk/class.c trunk/marshal.c trunk/proc.c trunk/sample/biorhythm.rb trunk/vm_eval.c trunk/vm_method.c Index: ChangeLog =================================================================== --- ChangeLog (revision 31030) +++ ChangeLog (revision 31031) @@ -1,3 +1,19 @@ +Sun Mar 6 05:21:41 2011 NARUSE, Yui <naruse@r...> + + * class.c: fix camelCase to snake_case in documentation code examples. + patched by Andrew Grimm. fixes Bug #4469 + + * marshal.c: ditto. + + * proc.c: ditto. + + * sample/biorhythm.rb: ditto. + + * vm_eval.c: ditto. + + * vm_method.c: ditto. + + Sun Mar 6 03:22:27 2011 KOSAKI Motohiro <kosaki.motohiro@g...> * io.c (io_cntl): use rb_thread_io_blocking_region() instead Index: sample/biorhythm.rb =================================================================== --- sample/biorhythm.rb (revision 31030) +++ sample/biorhythm.rb (revision 31031) @@ -29,13 +29,13 @@ require "optparse" require "optparse/date" -def printHeader(y, m, d, p, w) +def print_header(y, m, d, p, w) print "\n>>> Biorhythm <<<\n" printf "The birthday %04d.%02d.%02d is a %s\n", y, m, d, w printf "Age in days: [%d]\n\n", p end -def getPosition(z) +def get_position(z) pi = Math::PI z = Integer(z) phys = (50.0 * (1.0 + sin((z / 23.0 - (z / 23)) * 360.0 * pi / 180.0))).to_i @@ -89,24 +89,24 @@ display_period = options[:days] if ausgabeart == "v" - printHeader(bd.year, bd.month, bd.day, dd - bd, bd.strftime("%a")) + print_header(bd.year, bd.month, bd.day, dd - bd, bd.strftime("%a")) print "\n" - phys, emot, geist = getPosition(dd - bd) + phys, emot, geist = get_position(dd - bd) printf "Biorhythm: %04d.%02d.%02d\n", dd.year, dd.month, dd.day printf "Physical: %d%%\n", phys printf "Emotional: %d%%\n", emot printf "Mental: %d%%\n", geist print "\n" else - printHeader(bd.year, bd.month, bd.day, dd - bd, bd.strftime("%a")) + print_header(bd.year, bd.month, bd.day, dd - bd, bd.strftime("%a")) print " P=physical, E=emotional, M=mental\n" print " -------------------------+-------------------------\n" print " Bad Condition | Good Condition\n" print " -------------------------+-------------------------\n" (dd - bd).step(dd - bd + display_period) do |z| - phys, emot, geist = getPosition(z) + phys, emot, geist = get_position(z) printf "%04d.%02d.%02d : ", dd.year, dd.month, dd.day p = (phys / 2.0 + 0.5).to_i Index: vm_eval.c =================================================================== --- vm_eval.c (revision 31030) +++ vm_eval.c (revision 31031) @@ -459,12 +459,12 @@ * values. * * class Roman - * def romanToInt(str) + * def roman_to_int(str) * # ... * end * def method_missing(methId) * str = methId.id2name - * romanToInt(str) + * roman_to_int(str) * end * end * @@ -1082,12 +1082,12 @@ * optional <em>filename</em> and <em>lineno</em> parameters are * present, they will be used when reporting syntax errors. * - * def getBinding(str) + * def get_binding(str) * return binding * end * str = "hello" * eval "str + ' Fred'" #=> "hello Fred" - * eval "str + ' Fred'", getBinding("bye") #=> "bye Fred" + * eval "str + ' Fred'", get_binding("bye") #=> "bye Fred" */ VALUE Index: proc.c =================================================================== --- proc.c (revision 31030) +++ proc.c (revision 31031) @@ -336,10 +336,10 @@ * calling +eval+ to execute the evaluated command in this * environment. Also see the description of class +Binding+. * - * def getBinding(param) + * def get_binding(param) * return binding * end - * b = getBinding("hello") + * b = get_binding("hello") * eval("param", b) #=> "hello" */ @@ -358,10 +358,10 @@ * <em>lineno</em> parameters are present, they will be used when * reporting syntax errors. * - * def getBinding(param) + * def get_binding(param) * return binding * end - * b = getBinding("hello") + * b = get_binding("hello") * b.eval("param") #=> "hello" */ @@ -2211,15 +2211,15 @@ * def initialize(n) * @secret = n * end - * def getBinding + * def get_binding * return binding() * end * end * * k1 = Demo.new(99) - * b1 = k1.getBinding + * b1 = k1.get_binding * k2 = Demo.new(-3) - * b2 = k2.getBinding + * b2 = k2.get_binding * * eval("@secret", b1) #=> 99 * eval("@secret", b2) #=> -3 Index: vm_method.c =================================================================== --- vm_method.c (revision 31030) +++ vm_method.c (revision 31031) @@ -1152,20 +1152,20 @@ * end * class Cls * include Mod - * def callOne + * def call_one * one * end * end * Mod.one #=> "This is one" * c = Cls.new - * c.callOne #=> "This is one" + * c.call_one #=> "This is one" * module Mod * def one * "This is the new one" * end * end * Mod.one #=> "This is one" - * c.callOne #=> "This is the new one" + * c.call_one #=> "This is the new one" */ static VALUE Index: class.c =================================================================== --- class.c (revision 31030) +++ class.c (revision 31031) @@ -988,14 +988,14 @@ * <i>obj</i>'s ancestors. * * class Klass - * def kMethod() + * def klass_method() * end * end * k = Klass.new - * k.methods[0..9] #=> [:kMethod, :freeze, :nil?, :is_a?, - * # :class, :instance_variable_set, - * # :methods, :extend, :__send__, :instance_eval] - * k.methods.length #=> 42 + * k.methods[0..9] #=> [:klass_method, :nil?, :===, + * # :==~, :!, :eql? + * # :hash, :<=>, :class, :singleton_class] + * k.methods.length #=> 57 */ VALUE Index: marshal.c =================================================================== --- marshal.c (revision 31030) +++ marshal.c (revision 31031) @@ -876,7 +876,7 @@ * def initialize(str) * @str = str * end - * def sayHello + * def say_hello * @str * end * end @@ -886,7 +886,7 @@ * o = Klass.new("hello\n") * data = Marshal.dump(o) * obj = Marshal.load(data) - * obj.sayHello #=> "hello\n" + * obj.say_hello #=> "hello\n" * * Marshal can't dump following objects: * * anonymous Class/Module. -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/