view lib/redmine/core_ext/string.rb @ 1556:81dd71991dc1 feature_1136

hg-hash option does not appear reliable ("Not updating refs/notes/hg (new tip XXX does not contain YYY")
author Chris Cannam
date Wed, 13 Jan 2016 13:33:03 +0000
parents 433d4f72a19b
children
line wrap: on
line source
require File.dirname(__FILE__) + '/string/conversions'
require File.dirname(__FILE__) + '/string/inflections'

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