summaryrefslogtreecommitdiffstats
path: root/sample/cal.rb
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-06 00:38:22 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-06 00:38:22 +0000
commit065716c915e4974c525bb32a20af09c2e5c2cab1 (patch)
treefdbbe15e02321fd94b17cb58875a0cf7ccf11586 /sample/cal.rb
parentb6d768cf891545ca0362c78c2d52dc9df2e52130 (diff)
downloadruby-065716c915e4974c525bb32a20af09c2e5c2cab1.tar.gz
ruby-065716c915e4974c525bb32a20af09c2e5c2cab1.tar.xz
ruby-065716c915e4974c525bb32a20af09c2e5c2cab1.zip
* lib/date.rb, lib/date/format.rb: introduced some constants
(for internal use) and aliases (minute and second). * sample/cal.rb: trivial adjustments. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample/cal.rb')
-rw-r--r--sample/cal.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/sample/cal.rb b/sample/cal.rb
index d2105573b..387657490 100644
--- a/sample/cal.rb
+++ b/sample/cal.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby
-# cal.rb: Written by Tadayoshi Funaba 1998-2004,2006
-# $Id: cal.rb,v 2.10 2006-12-30 21:44:44+09 tadf Exp $
+# cal.rb: Written by Tadayoshi Funaba 1998-2004,2006,2008
+# $Id: cal.rb,v 2.11 2008-01-06 08:42:17+09 tadf Exp $
require 'date'
@@ -53,7 +53,7 @@ class Cal
end
def pict(y, m)
- d = (1..31).detect{|d| Date.valid_date?(y, m, d, @start)}
+ d = (1..31).detect{|x| Date.valid_date?(y, m, x, @start)}
fi = Date.new(y, m, d, @start)
fi -= (fi.jd - @k + 1) % 7
@@ -162,3 +162,5 @@ if __FILE__ == $0
print cal.print(y, m)
end
+
+# See Bird & Wadler's Introduction to functional programming 4.5.