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/branches/ruby_1_8@11772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
75fbcb9560
commit
3ab997c07e
2 changed files with 13 additions and 9 deletions
|
@ -1,3 +1,7 @@
|
|||
Sun Feb 18 19:35:21 2007 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* lib/date/format.rb: updated based on date2 4.0.3.
|
||||
|
||||
Fri Feb 16 11:18:21 2007 Eric Hodel <drbrain@segment7.net>
|
||||
|
||||
* lib/.document: Apply patch for irb, e2mmap and README by Hugh Sasse
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue