diff lib/redmine/core_ext/string.rb @ 1115:433d4f72a19b redmine-2.2

Update to Redmine SVN revision 11137 on 2.2-stable branch
author Chris Cannam
date Mon, 07 Jan 2013 12:01:42 +0000
parents 513646585e45
children
line wrap: on
line diff
--- a/lib/redmine/core_ext/string.rb	Wed Jun 27 14:54:18 2012 +0100
+++ b/lib/redmine/core_ext/string.rb	Mon Jan 07 12:01:42 2013 +0000
@@ -4,4 +4,8 @@
 class String #:nodoc:
   include Redmine::CoreExtensions::String::Conversions
   include Redmine::CoreExtensions::String::Inflections
+
+  def is_binary_data?
+    ( self.count( "^ -~", "^\r\n" ).fdiv(self.size) > 0.3 || self.index( "\x00" ) ) unless empty?
+  end
 end