Skip to content
This repository
Browse code

remove dead code as ruby 1.9.3 has Base64 module

  • Loading branch information...
commit 55943873cdfc44aa55090d34602c2e1529d87590 1 parent afea8c7
Sergey Nartimov authored
32  activesupport/lib/active_support/base64.rb
... ...
@@ -1,35 +1,7 @@
1  
-begin
2  
-  require 'base64'
3  
-rescue LoadError
4  
-end
  1
+require 'base64'
5 2
 
6 3
 module ActiveSupport
7  
-  if defined? ::Base64
8  
-    Base64 = ::Base64
9  
-  else
10  
-    # Base64 provides utility methods for encoding and de-coding binary data
11  
-    # using a base 64 representation. A base 64 representation of binary data
12  
-    # consists entirely of printable US-ASCII characters. The Base64 module
13  
-    # is included in Ruby 1.8, but has been removed in Ruby 1.9.
14  
-    module Base64
15  
-      # Encodes a string to its base 64 representation. Each 60 characters of
16  
-      # output is separated by a newline character.
17  
-      #
18  
-      #  ActiveSupport::Base64.encode64("Original unencoded string")
19  
-      #  # => "T3JpZ2luYWwgdW5lbmNvZGVkIHN0cmluZw==\n"
20  
-      def self.encode64(data)
21  
-        [data].pack("m")
22  
-      end
23  
-
24  
-      # Decodes a base 64 encoded string to its original representation.
25  
-      #
26  
-      #  ActiveSupport::Base64.decode64("T3JpZ2luYWwgdW5lbmNvZGVkIHN0cmluZw==")
27  
-      #  # => "Original unencoded string"
28  
-      def self.decode64(data)
29  
-        data.unpack("m").first
30  
-      end
31  
-    end
32  
-  end
  4
+  Base64 = ::Base64
33 5
 
34 6
   # Encodes the value as base64 without the newline breaks. This makes the base64 encoding readily usable as URL parameters
35 7
   # or memcache keys without further processing.

0 notes on commit 5594387

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