mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* sample/test.rb: substitute 'select' with 'values_at'.
* lib/date.rb: ditto. * lib/parsedate.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
79f7c2b1b6
commit
b65e3629da
4 changed files with 12 additions and 4 deletions
|
@ -1,3 +1,11 @@
|
|||
Mon May 5 18:59:45 2003 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||
|
||||
* sample/test.rb: substitute 'select' with 'values_at'.
|
||||
|
||||
* lib/date.rb: ditto.
|
||||
|
||||
* lib/parsedate.rb: ditto.
|
||||
|
||||
Mon May 5 00:46:10 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* array.c (rb_ary_values_at): new method to replace select(index..).
|
||||
|
|
|
@ -218,7 +218,7 @@ class Date
|
|||
|
||||
def self.new_with_hash(elem, sg)
|
||||
elem ||= {}
|
||||
y, m, d = elem.select(:year, :mon, :mday)
|
||||
y, m, d = elem.values_at(:year, :mon, :mday)
|
||||
if [y, m, d].include? nil
|
||||
raise ArgumentError, 'invalid date'
|
||||
else
|
||||
|
@ -476,7 +476,7 @@ class DateTime < Date
|
|||
def self.new_with_hash(elem, sg)
|
||||
elem ||= {}
|
||||
y, m, d, h, min, s, of =
|
||||
elem.select(:year, :mon, :mday, :hour, :min, :sec, :offset)
|
||||
elem.values_at(:year, :mon, :mday, :hour, :min, :sec, :offset)
|
||||
h ||= 0
|
||||
min ||= 0
|
||||
s ||= 0
|
||||
|
|
|
@ -7,7 +7,7 @@ module ParseDate
|
|||
|
||||
def parsedate(str, comp=false)
|
||||
Date._parse(str, comp).
|
||||
select(:year, :mon, :mday, :hour, :min, :sec, :zone, :wday)
|
||||
values_at(:year, :mon, :mday, :hour, :min, :sec, :zone, :wday)
|
||||
end
|
||||
|
||||
module_function :parsedate
|
||||
|
|
|
@ -758,7 +758,7 @@ test_ok(begin
|
|||
test_ok($x.length == 3)
|
||||
test_ok($x.has_key?(1))
|
||||
test_ok($x.has_value?(4))
|
||||
test_ok($x.select(2,3) == [4,6])
|
||||
test_ok($x.values_at(2,3) == [4,6])
|
||||
test_ok($x == {1=>2, 2=>4, 3=>6})
|
||||
|
||||
$z = $y.keys.join(":")
|
||||
|
|
Loading…
Add table
Reference in a new issue