aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/base64/encoding.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/core_ext/base64/encoding.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/base64/encoding.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/base64/encoding.rb b/activesupport/lib/active_support/core_ext/base64/encoding.rb
new file mode 100644
index 0000000000..19671992d2
--- /dev/null
+++ b/activesupport/lib/active_support/core_ext/base64/encoding.rb
@@ -0,0 +1,13 @@
+module ActiveSupport #:nodoc:
+ module CoreExtensions #:nodoc:
+ module Base64 #:nodoc:
+ module Encoding
+ # Encodes the value as base64 without the newline breaks. This makes the base64 encoding readily usable as URL parameters
+ # or memcache keys without further processing.
+ def encode64s(value)
+ ::Base64.encode64(value).gsub(/\n/, '')
+ end
+ end
+ end
+ end
+end \ No newline at end of file