1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

updated based on date2 4.0.3.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tadf 2007-02-18 10:34:58 +00:00
parent 562f256c54
commit c04f4aa0ee
2 changed files with 14 additions and 9 deletions

View file

@ -1,3 +1,7 @@
Sun Feb 18 19:33:00 2007 Tadayoshi Funaba <tadf@dotrb.org>
* lib/date/format.rb: updated based on date2 4.0.3.
Sun Feb 18 13:11:51 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (pid_t, uid_t, gid_t): check if defined.

View file

@ -1,5 +1,5 @@
# format.rb: Written by Tadayoshi Funaba 1999-2007
# $Id: format.rb,v 2.30 2007-01-07 09:16:24+09 tadf Exp $
# $Id: format.rb,v 2.31 2007-02-18 12:08:09+09 tadf Exp $
require 'rational'
@ -95,23 +95,24 @@ class Date
end
class Bag # :nodoc:
def initialize
@_dict = {}
@elem = {}
end
def method_missing(t, *args, &block)
if /=$/ =~ t
t = t.to_s.chomp('=').to_sym
@_dict[t] = args[0]
t = t.to_s
set = t.chomp!('=')
t = t.intern
if set
@elem[t] = args[0]
else
if @_dict.key?(t)
@_dict[t]
end
@elem[t]
end
end
def to_hash
@_dict.reject{|k,v| /^_/ =~ k}
@elem.reject{|k, v| /\A_/ =~ k.to_s || v.nil?}
end
end