diff options
Diffstat (limited to 'activesupport/lib/active_support/base64.rb')
-rw-r--r-- | activesupport/lib/active_support/base64.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/base64.rb b/activesupport/lib/active_support/base64.rb new file mode 100644 index 0000000000..4fc8cd13a7 --- /dev/null +++ b/activesupport/lib/active_support/base64.rb @@ -0,0 +1,17 @@ +module ActiveSupport + if defined? ::Base64 + Base64 = ::Base64 + else + # Ruby 1.9 doesn't provide base64, so we wrap this here + module Base64 + + def self.encode64(data) + [data].pack("m") + end + + def self.decode64(data) + data.unpack("m").first + end + end + end +end |