Skip to content
This repository
Browse code

Merge pull request #4275 from lest/3-2-deprecate-activesupport-base64

deprecate AS::Base64 methods without DeprecatedConstantProxy
  • Loading branch information...
commit c032ff6e3ccf2890c5f404a1243b966f25737117 2 parents 853de2b + 1fc53df
José Valim authored January 03, 2012

Showing 1 changed file with 18 additions and 13 deletions. Show diff stats Hide diff stats

  1. 31  activesupport/lib/active_support/base64.rb
31  activesupport/lib/active_support/base64.rb
@@ -30,18 +30,23 @@ def Base64.strict_encode64(value)
30 30
 end
31 31
 
32 32
 module ActiveSupport
33  
-  Base64 = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('ActiveSupport::Base64', '::Base64')
34  
-  
35  
-  # *DEPRECATED*: Use +Base64.strict_encode64+ instead.
36  
-  #
37  
-  # Encodes the value as base64 without the newline breaks. This makes the base64 encoding readily usable as URL parameters
38  
-  # or memcache keys without further processing.
39  
-  #
40  
-  #  ActiveSupport::Base64.encode64s("Original unencoded string")
41  
-  #  # => "T3JpZ2luYWwgdW5lbmNvZGVkIHN0cmluZw=="
42  
-  def Base64.encode64s(value)
43  
-    ActiveSupport::Deprecation.warn "encode64s " \
44  
-      "is deprecated. Use Base64.strict_encode64 instead", caller
45  
-    encode64(value).gsub(/\n/, '')
  33
+  module Base64
  34
+    def self.encode64(value)
  35
+      ActiveSupport::Deprecation.warn "ActiveSupport::Base64.encode64 " \
  36
+        "is deprecated. Use Base64.encode64 instead", caller
  37
+      ::Base64.encode64(value)
  38
+    end
  39
+
  40
+    def self.decode64(value)
  41
+      ActiveSupport::Deprecation.warn "ActiveSupport::Base64.decode64 " \
  42
+        "is deprecated. Use Base64.decode64 instead", caller
  43
+      ::Base64.encode64(value)
  44
+    end
  45
+
  46
+    def self.encode64s(value)
  47
+      ActiveSupport::Deprecation.warn "ActiveSupport::Base64.encode64s " \
  48
+        "is deprecated. Use Base64.strict_encode64 instead", caller
  49
+      ::Base64.strict_encode64(value)
  50
+    end
46 51
   end
47 52
 end

0 notes on commit c032ff6

Please sign in to comment.
Something went wrong with that request. Please try again.