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 | a240cb3ca7792953c697741280d80ea221882410 (patch) | |
| tree | 8e93836e61e4fa82545677756187aa9004d72773 | |
| parent | adbd40a44c989645df48bf570132b5415b7dd393 (diff) | |
| download | ruby-a240cb3ca7792953c697741280d80ea221882410.tar.gz ruby-a240cb3ca7792953c697741280d80ea221882410.tar.xz ruby-a240cb3ca7792953c697741280d80ea221882410.zip | |
updated based on date2 4.0.3.
git-svn-id: http://svn.ruby-lang.org/repos/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 7a4633a63..7c7c9f988 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 |
