From 065716c915e4974c525bb32a20af09c2e5c2cab1 Mon Sep 17 00:00:00 2001 From: tadf Date: Sun, 6 Jan 2008 00:38:22 +0000 Subject: * 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 --- sample/cal.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'sample') 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. -- cgit