aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorAnton Davydov <antondavydov.o@gmail.com>2015-02-28 16:28:54 +0300
committerAnton Davydov <antondavydov.o@gmail.com>2015-02-28 16:28:54 +0300
commitdde6ee9e9b4c04aa56350b34ae74bb0ad0cf8420 (patch)
tree59ba412d003c47a932650075ba8faadc8f2af8bd /activesupport
parent35ae975beb0a41f9909a52b5cdffff510758b847 (diff)
downloadrails-dde6ee9e9b4c04aa56350b34ae74bb0ad0cf8420.tar.gz
rails-dde6ee9e9b4c04aa56350b34ae74bb0ad0cf8420.tar.bz2
rails-dde6ee9e9b4c04aa56350b34ae74bb0ad0cf8420.zip
[skip ci] Add documentation for String#is_utf8? method
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/string/multibyte.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/multibyte.rb b/activesupport/lib/active_support/core_ext/string/multibyte.rb
index 2eedd4fdb1..57d7f8d1e7 100644
--- a/activesupport/lib/active_support/core_ext/string/multibyte.rb
+++ b/activesupport/lib/active_support/core_ext/string/multibyte.rb
@@ -35,6 +35,13 @@ class String
ActiveSupport::Multibyte.proxy_class.new(self)
end
+ # Return +true+ if string has utf_8 encoding.
+ #
+ # utf_8_str = "some string".encode "UTF-8"
+ # iso_str = "some string".encode "ISO-8859-1"
+ #
+ # utf_8_str.is_utf8? # => true
+ # iso_str.is_utf8? # => false
def is_utf8?
case encoding
when Encoding::UTF_8