public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
ActiveSupport::Base64.encode64s since Base64 is deprecated


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8817 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
jeremy (author)
Thu Feb 07 13:50:46 -0800 2008
commit  3335bd12c8b3fbfe33ceda4b4f2f33ef023571da
tree    8e257d33eeaf92629c4c3435cee61347755245cb
parent  fbd7ec3c9f0b1a5327ead66e0ac11b1d1d509f70
...
 
 
 
 
 
1
2
3
...
1
2
3
4
5
6
7
8
0
@@ -1,3 +1,8 @@
0
+begin
0
+ require 'base64'
0
+rescue LoadError
0
+end
0
+
0
 module ActiveSupport
0
   if defined? ::Base64
0
     Base64 = ::Base64
...
1
2
 
3
4
5
6
7
 
...
 
 
1
2
3
 
 
 
4
0
@@ -1,7 +1,4 @@
0
-require 'base64'
0
-
0
+require 'active_support/base64'
0
 require 'active_support/core_ext/base64/encoding'
0
 
0
-module Base64#:nodoc:
0
- extend ActiveSupport::CoreExtensions::Base64::Encoding
0
-end
0
+ActiveSupport::Base64.extend ActiveSupport::CoreExtensions::Base64::Encoding
...
5
6
7
8
 
9
10
11
12
13
14
 
...
5
6
7
 
8
9
10
11
12
 
13
14
0
@@ -5,9 +5,9 @@ module ActiveSupport #:nodoc:
0
         # Encodes the value as base64 without the newline breaks. This makes the base64 encoding readily usable as URL parameters
0
         # or memcache keys without further processing.
0
         def encode64s(value)
0
- ::Base64.encode64(value).gsub(/\n/, '')
0
+ encode64(value).gsub(/\n/, '')
0
         end
0
       end
0
     end
0
   end
0
-end
0
\ No newline at end of file
0
+end
...
77
78
79
80
 
81
82
 
83
84
85
...
77
78
79
 
80
81
 
82
83
84
85
0
@@ -77,9 +77,9 @@ module ActiveSupport #:nodoc:
0
             "boolean" => Proc.new { |boolean| %w(1 true).include?(boolean.strip) },
0
             "string" => Proc.new { |string| string.to_s },
0
             "yaml" => Proc.new { |yaml| YAML::load(yaml) rescue yaml },
0
- "base64Binary" => Proc.new { |bin| Base64.decode64(bin) },
0
+ "base64Binary" => Proc.new { |bin| ActiveSupport::Base64.decode64(bin) },
0
             "file" => Proc.new do |file, entity|
0
- f = StringIO.new(Base64.decode64(file))
0
+ f = StringIO.new(ActiveSupport::Base64.decode64(file))
0
               f.extend(FileLike)
0
               f.original_filename = entity['name']
0
               f.content_type = entity['content_type']
...
2
3
4
5
6
 
 
7
8
...
2
3
4
 
 
5
6
7
8
0
@@ -2,7 +2,7 @@ require 'abstract_unit'
0
 
0
 class Base64Test < Test::Unit::TestCase
0
   def test_no_newline_in_encoded_value
0
- assert_match /\n/, Base64.encode64("oneverylongstringthatwouldnormallybesplitupbynewlinesbytheregularbase64")
0
- assert_no_match /\n/, Base64.encode64s("oneverylongstringthatwouldnormallybesplitupbynewlinesbytheregularbase64")
0
+ assert_match(/\n/, ActiveSupport::Base64.encode64("oneverylongstringthatwouldnormallybesplitupbynewlinesbytheregularbase64"))
0
+ assert_no_match(/\n/, ActiveSupport::Base64.encode64s("oneverylongstringthatwouldnormallybesplitupbynewlinesbytheregularbase64"))
0
   end
0
 end

Comments

    No one has commented yet.