summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--lib/date/format.rb16
2 files changed, 12 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 808411c45c..4d3870d21c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sat Feb 24 17:04:01 2007 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/format.rb: updated based on date2 4.0.3.
+
Sat Feb 24 17:01:02 2007 Minero Aoki <aamine@loveruby.net>
* ext/racc/cparse/cparse.c (cparse_params_mark): remove useless
diff --git a/lib/date/format.rb b/lib/date/format.rb
index ca890cf8f5..8bd14c7fd0 100644
--- a/lib/date/format.rb
+++ b/lib/date/format.rb
@@ -96,23 +96,23 @@ class Date
class Bag # :nodoc:
+ def initialize
+ @elem = {}
+ end
+
def method_missing(t, *args, &block)
t = t.to_s
set = t.chomp!('=')
- t = '@' + t
+ t = t.intern
if set
- instance_variable_set(t, *args)
+ @elem[t] = args[0]
else
- if instance_variables.include?(t)
- instance_variable_get(t)
- end
+ @elem[t]
end
end
def to_hash
- instance_variables.
- select{|n| !instance_variable_get(n).nil?}.grep(/\A@[^_]/).
- inject({}){|r, n| r[n[1..-1].intern] = instance_variable_get(n); r}
+ @elem.reject{|k, v| /\A_/ =~ k.to_s || v.nil?}
end
end