From fd0ab684150cde7672d5e3d524c9c1813b05e76f Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 16 Nov 2007 02:16:43 +0000 Subject: * lib/yaml/rubytypes.rb (String#is_binary_data?): use Integer#fdiv. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/yaml/rubytypes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/yaml/rubytypes.rb b/lib/yaml/rubytypes.rb index dc6bb3359f..35b719196e 100644 --- a/lib/yaml/rubytypes.rb +++ b/lib/yaml/rubytypes.rb @@ -143,7 +143,7 @@ class String to_yaml_style or not to_yaml_properties.empty? or self =~ /\n.+/ end def is_binary_data? - ( self.count( "^ -~", "^\r\n" ) / self.size > 0.3 || self.count( "\x00" ) > 0 ) unless empty? + ( self.count( "^ -~", "^\r\n" ).fdiv(self.size) > 0.3 || self.index( "\x00" ) ) unless empty? end def String.yaml_new( klass, tag, val ) val = val.unpack("m")[0] if tag == "tag:yaml.org,2002:binary" -- cgit v1.2.3