summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYukihiro Matsumoto <matz@ruby-lang.org>1997-12-09 17:54:56 +0900
committerTakashi Kokubun <takashikkbn@gmail.com>2019-08-17 22:09:33 +0900
commit66541bbb3630a5c512f8012c52ae777ab83beba5 (patch)
treebe1431b56b485de6cb1da065bb2161551872820d /lib
parentfb0fe24512d1796f794306768ddac37566e9a209 (diff)
version 1.0-971209v1_0_971209
https://cache.ruby-lang.org/pub/ruby/1.0/ruby-1.0-971209.tar.gz Tue Dec 9 17:54:56 1997 Yukihiro Matsumoto <matz@netlab.co.jp> * version 1.0-971209 * sample/ruby-mode.el (ruby-expr-beg): forgot to handle modifiers. * parse.y (tokadd): token buffer overrun.
Diffstat (limited to 'lib')
-rw-r--r--lib/date.rb16
-rw-r--r--lib/tkcanvas.rb2
2 files changed, 12 insertions, 6 deletions
diff --git a/lib/date.rb b/lib/date.rb
index 260f6e7..cfb9b96 100644
--- a/lib/date.rb
+++ b/lib/date.rb
@@ -73,8 +73,8 @@ class Date
end
def +(o)
- if o.kind_of?(Integer)
- d = self.period + o
+ if o.kind_of?(Numeric)
+ d = Integer(self.period + o)
elsif o.kind_of?(Date)
d = self.period + o.period
else
@@ -84,10 +84,10 @@ class Date
end
def -(o)
- if o.kind_of?(Integer)
- d = self.period - o
+ if o.kind_of?(Numeric)
+ d = Integer(self.period - o)
elsif o.kind_of?(Date)
- d = self.period - o.period
+ return Integer(self.period - o.period)
else
raise TypeError, "Illegal type. (Integer or Date)"
end
@@ -150,6 +150,12 @@ class Date
end
def Date.at(d)
+ if d.kind_of? Time
+ return Date.new(1900+d.year, d.mon, d.mday)
+ end
+ if d.kind_of? Date
+ return Date.at(d.period)
+ end
mm = 1
yy = (d / 366.0).to_i
if yy != 0
diff --git a/lib/tkcanvas.rb b/lib/tkcanvas.rb
index 26f0ac0..de727c3 100644
--- a/lib/tkcanvas.rb
+++ b/lib/tkcanvas.rb
@@ -92,7 +92,7 @@ class TkCanvas<TkWindow
def itemtype(tag)
tk_send 'type', tagid(tag)
end
- def postscript(keys=None)
+ def postscript(keys)
tk_send "postscript", *hash_kv(keys)
end
def raise(tag, above=None)