From bf9bbe3da819acd6c70e7ebb0018dc9aebe8bd21 Mon Sep 17 00:00:00 2001 From: Akinori MUSHA Date: Tue, 16 Apr 2013 22:15:29 +0900 Subject: [PATCH] Move Array#sort_by! to http/cookie/ruby_compat. --- lib/http/cookie/ruby_compat.rb | 4 ++++ lib/http/cookie_jar/hash_store.rb | 8 -------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/http/cookie/ruby_compat.rb b/lib/http/cookie/ruby_compat.rb index b82a069..53782c1 100644 --- a/lib/http/cookie/ruby_compat.rb +++ b/lib/http/cookie/ruby_compat.rb @@ -10,6 +10,10 @@ class Array self[i..-1] = [] self end unless method_defined?(:select!) + + def sort_by!(&block) + replace(sort_by(&block)) + end unless method_defined?(:sort_by!) end class Hash diff --git a/lib/http/cookie_jar/hash_store.rb b/lib/http/cookie_jar/hash_store.rb index 4478fc7..2909eb3 100644 --- a/lib/http/cookie_jar/hash_store.rb +++ b/lib/http/cookie_jar/hash_store.rb @@ -1,13 +1,5 @@ require 'http/cookie_jar' -# :stopdoc: -class Array - def sort_by!(&block) - replace(sort_by(&block)) - end unless method_defined?(:sort_by!) -end -# :startdoc: - class HTTP::CookieJar # A store class that uses a hash-based cookie store. #