Skip to content
This repository

deprecate AS::Base64 methods without DeprecatedConstantProxy #4275

Merged
merged 1 commit into from over 2 years ago

2 participants

Sergey Nartimov José Valim
Sergey Nartimov

No description provided.

Sergey Nartimov

@josevalim using DeprecatedConstantProxy cause tests to fail under 1.8.7

José Valim josevalim merged commit c032ff6 into from January 03, 2012
José Valim josevalim closed this January 03, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Jan 03, 2012
Sergey Nartimov deprecate AS::Base64 methods without DeprecatedConstantProxy 1fc53df
This page is out of date. Refresh to see the latest.

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
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.