diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-04-25 17:17:49 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-04-25 17:17:49 +0000 |
commit | 5e57a1a9d9478162ac4f27ae96b2ccaf55a1aba7 (patch) | |
tree | 93e57765139714bd82dede475725516c448c0d55 /lib/vendor/tmail-1.2.7/tmail/compat.rb | |
parent | 34e20c4373b7f5a20ab3a132feae3f70f21ec477 (diff) | |
download | redmine-5e57a1a9d9478162ac4f27ae96b2ccaf55a1aba7.tar.gz redmine-5e57a1a9d9478162ac4f27ae96b2ccaf55a1aba7.zip |
Merged rails-3.2 branch.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9528 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/vendor/tmail-1.2.7/tmail/compat.rb')
-rw-r--r-- | lib/vendor/tmail-1.2.7/tmail/compat.rb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/vendor/tmail-1.2.7/tmail/compat.rb b/lib/vendor/tmail-1.2.7/tmail/compat.rb new file mode 100644 index 000000000..1275df79a --- /dev/null +++ b/lib/vendor/tmail-1.2.7/tmail/compat.rb @@ -0,0 +1,41 @@ +#:stopdoc: +unless Enumerable.method_defined?(:map) + module Enumerable #:nodoc: + alias map collect + end +end + +unless Enumerable.method_defined?(:select) + module Enumerable #:nodoc: + alias select find_all + end +end + +unless Enumerable.method_defined?(:reject) + module Enumerable #:nodoc: + def reject + result = [] + each do |i| + result.push i unless yield(i) + end + result + end + end +end + +unless Enumerable.method_defined?(:sort_by) + module Enumerable #:nodoc: + def sort_by + map {|i| [yield(i), i] }.sort.map {|val, i| i } + end + end +end + +unless File.respond_to?(:read) + def File.read(fname) #:nodoc: + File.open(fname) {|f| + return f.read + } + end +end +#:startdoc:
\ No newline at end of file |