Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/fixes/yaml.rb,
lib/fixes/singular.rb

Overview

FIXME: the following works around Character::Encoding::UTF8 hanging when

yaml's String#is_binary_data? calls self.count("\x00")

Direct Known Subclasses

ODDB::Text::Paragraph, ODDB::Text::Picture

Instance Method Summary collapse

Instance Method Details

#is_binary_data?Boolean

Returns:

  • (Boolean)


9
10
11
12
# File 'lib/fixes/yaml.rb', line 9

def is_binary_data?
  ( self.count( "^ -~", "^\r\n" ) / self.size > 0.3 \
   || self.include?( "\x00" ) ) unless empty?
end