* sample/cal.rb: just updated with the newest version.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
27bcfc3dc8
commit
5b0ab11b0a
@ -1,3 +1,7 @@
|
|||||||
|
Wed Jan 2 08:58:54 2008 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
|
* sample/cal.rb: just updated with the newest version.
|
||||||
|
|
||||||
Wed Jan 2 01:19:31 2008 Tanaka Akira <akr@fsij.org>
|
Wed Jan 2 01:19:31 2008 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* enc/depend: dependency updated.
|
* enc/depend: dependency updated.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#! /usr/bin/env ruby
|
#! /usr/bin/env ruby
|
||||||
|
|
||||||
# cal.rb: Written by Tadayoshi Funaba 1998-2004
|
# cal.rb: Written by Tadayoshi Funaba 1998-2004,2006
|
||||||
# $Id: cal.rb,v 2.8 2004-09-25 12:50:10+09 tadf Exp $
|
# $Id: cal.rb,v 2.10 2006-12-30 21:44:44+09 tadf Exp $
|
||||||
|
|
||||||
require 'date'
|
require 'date'
|
||||||
|
|
||||||
@ -9,7 +9,7 @@ class Cal
|
|||||||
|
|
||||||
START =
|
START =
|
||||||
{
|
{
|
||||||
'cn' => true, # China
|
'cn' => Date::GREGORIAN, # China
|
||||||
'de' => 2342032, # Germany (protestant states)
|
'de' => 2342032, # Germany (protestant states)
|
||||||
'dk' => 2342032, # Denmark
|
'dk' => 2342032, # Denmark
|
||||||
'es' => 2299161, # Spain
|
'es' => 2299161, # Spain
|
||||||
@ -19,15 +19,15 @@ class Cal
|
|||||||
'gr' => 2423868, # Greece
|
'gr' => 2423868, # Greece
|
||||||
'hu' => 2301004, # Hungary
|
'hu' => 2301004, # Hungary
|
||||||
'it' => 2299161, # Italy
|
'it' => 2299161, # Italy
|
||||||
'jp' => true, # Japan
|
'jp' => Date::GREGORIAN, # Japan
|
||||||
'no' => 2342032, # Norway
|
'no' => 2342032, # Norway
|
||||||
'pl' => 2299161, # Poland
|
'pl' => 2299161, # Poland
|
||||||
'pt' => 2299161, # Portugal
|
'pt' => 2299161, # Portugal
|
||||||
'ru' => 2421639, # Russia
|
'ru' => 2421639, # Russia
|
||||||
'se' => 2361390, # Sweden
|
'se' => 2361390, # Sweden
|
||||||
'us' => 2361222, # United States
|
'us' => 2361222, # United States
|
||||||
'os' => false, # (old style)
|
'os' => Date::JULIAN, # (old style)
|
||||||
'ns' => true # (new style)
|
'ns' => Date::GREGORIAN # (new style)
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFAULT_START = 'gb'
|
DEFAULT_START = 'gb'
|
||||||
@ -72,7 +72,7 @@ class Cal
|
|||||||
|
|
||||||
ca = %w(January February March April May June July
|
ca = %w(January February March April May June July
|
||||||
August September October November December)[m - 1]
|
August September October November December)[m - 1]
|
||||||
ca = ca + ' ' + y.to_s if not @opt_y
|
ca = ca + ' ' + y.to_s if !@opt_y
|
||||||
ca = ca.center(@mw)
|
ca = ca.center(@mw)
|
||||||
|
|
||||||
ta.unshift(ca)
|
ta.unshift(ca)
|
||||||
@ -150,13 +150,13 @@ if __FILE__ == $0
|
|||||||
end
|
end
|
||||||
|
|
||||||
y, m = ARGV.values_at(1, 0).compact.collect{|x| x.to_i}
|
y, m = ARGV.values_at(1, 0).compact.collect{|x| x.to_i}
|
||||||
cal.opt_y(true) if y and not m
|
cal.opt_y(true) if y && !m
|
||||||
|
|
||||||
to = Date.today
|
to = Date.today
|
||||||
y ||= to.year
|
y ||= to.year
|
||||||
m ||= to.mon
|
m ||= to.mon
|
||||||
|
|
||||||
usage unless m >= 1 and m <= 12
|
usage unless m >= 1 && m <= 12
|
||||||
usage unless y >= -4712
|
usage unless y >= -4712
|
||||||
|
|
||||||
print cal.print(y, m)
|
print cal.print(y, m)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user