summaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-05 20:25:08 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-05 20:25:08 +0000
commit18f4f0888513be990c164ecd5b3ea92e24570240 (patch)
tree5e1b033fb2b21d5158d84b65caffd35f9a602ad5 /sample
parent7f1362a84e692ad84aa412d7b51490401b58efed (diff)
* 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
Diffstat (limited to 'sample')
-rw-r--r--sample/biorhythm.rb12
1 files changed, 6 insertions, 6 deletions
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