diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-02-18 10:34:58 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-02-18 10:34:58 +0000 |
commit | c04f4aa0ee1a70768c785ac00160eb0e0f22d7fc (patch) | |
tree | 8e93836e61e4fa82545677756187aa9004d72773 | |
parent | 562f256c54dbb1a0a26699ba3dceba24062a9b11 (diff) | |
download | ruby-c04f4aa0ee1a70768c785ac00160eb0e0f22d7fc.tar.gz |
updated based on date2 4.0.3.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | lib/date/format.rb | 19 |
2 files changed, 14 insertions, 9 deletions
@@ -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. diff --git a/lib/date/format.rb b/lib/date/format.rb index 7a4633a638..7c7c9f988b 100644 --- a/lib/date/format.rb +++ b/lib/date/format.rb @@ -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 |