From 18f4f0888513be990c164ecd5b3ea92e24570240 Mon Sep 17 00:00:00 2001 From: naruse Date: Sat, 5 Mar 2011 20:25:08 +0000 Subject: * 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- sample/biorhythm.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sample/biorhythm.rb') diff --git a/sample/biorhythm.rb b/sample/biorhythm.rb index 6465daa29f..7a8da7d124 100644 --- a/sample/biorhythm.rb +++ b/sample/biorhythm.rb @@ -29,13 +29,13 @@ require "date.rb" 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 @@ ausgabeart = options[:graph] ? "g" : "v" 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 -- cgit v1.2.3