root/trunk/activesupport/lib/active_support/base64.rb
| Revision 8817, 354 bytes (checked in by bitsweat, 5 months ago) |
|---|
| Line | |
|---|---|
| 1 | begin |
| 2 | require 'base64' |
| 3 | rescue LoadError |
| 4 | end |
| 5 | |
| 6 | module ActiveSupport |
| 7 | if defined? ::Base64 |
| 8 | Base64 = ::Base64 |
| 9 | else |
| 10 | # Ruby 1.9 doesn't provide base64, so we wrap this here |
| 11 | module Base64 |
| 12 | |
| 13 | def self.encode64(data) |
| 14 | [data].pack("m") |
| 15 | end |
| 16 | |
| 17 | def self.decode64(data) |
| 18 | data.unpack("m").first |
| 19 | end |
| 20 | end |
| 21 | end |
| 22 | end |
Note: See TracBrowser for help on using the browser.