Sha256: c974e5a0dd9ef877f0be1c88c2275622f48fc1987aedc81a119661881cd1b51c

Contents?: true

Size: 519 Bytes

Versions: 90

Compression:

Stored size: 519 Bytes

Contents

# encoding: utf-8
class String #:nodoc:
  def to_crlf
    gsub(/\n|\r\n|\r/) { "\r\n" }
  end

  def to_lf
    gsub(/\n|\r\n|\r/) { "\n" }
  end

  unless method_defined?(:ascii_only?)
    # Provides all strings with the Ruby 1.9 method of .ascii_only? and
    # returns true or false
    US_ASCII_REGEXP = %Q{\x00-\x7f}
    def ascii_only?
      !(self =~ /[^#{US_ASCII_REGEXP}]/)
    end
  end
  
  def not_ascii_only?
    !ascii_only?
  end

  unless method_defined?(:bytesize)
    alias :bytesize :length
  end
end

Version data entries

90 entries across 60 versions & 4 rubygems

Version Path
depengine-0.0.31 etc/isolate/ruby-1.8/gems/mail-2.2.5/lib/mail/core_extensions/string.rb
depengine-0.0.31 etc/isolate/jruby-1.8/gems/mail-2.2.5/lib/mail/core_extensions/string.rb
depengine-0.0.30 etc/isolate/ruby-1.8/gems/mail-2.2.5/lib/mail/core_extensions/string.rb
depengine-0.0.30 etc/isolate/jruby-1.8/gems/mail-2.2.5/lib/mail/core_extensions/string.rb
depengine-0.0.29 etc/isolate/jruby-1.8/gems/mail-2.2.5/lib/mail/core_extensions/string.rb
depengine-0.0.29 etc/isolate/ruby-1.8/gems/mail-2.2.5/lib/mail/core_extensions/string.rb
depengine-0.0.28 etc/isolate/ruby-1.8/gems/mail-2.2.5/lib/mail/core_extensions/string.rb
depengine-0.0.28 etc/isolate/jruby-1.8/gems/mail-2.2.5/lib/mail/core_extensions/string.rb
depengine-0.0.27 etc/isolate/ruby-1.8/gems/mail-2.2.5/lib/mail/core_extensions/string.rb
depengine-0.0.27 etc/isolate/jruby-1.8/gems/mail-2.2.5/lib/mail/core_extensions/string.rb
depengine-0.0.26 etc/isolate/ruby-1.8/gems/mail-2.2.5/lib/mail/core_extensions/string.rb
depengine-0.0.26 etc/isolate/jruby-1.8/gems/mail-2.2.5/lib/mail/core_extensions/string.rb
depengine-0.0.25 etc/isolate/jruby-1.8/gems/mail-2.2.5/lib/mail/core_extensions/string.rb
depengine-0.0.25 etc/isolate/ruby-1.8/gems/mail-2.2.5/lib/mail/core_extensions/string.rb
depengine-0.0.24 etc/isolate/jruby-1.8/gems/mail-2.2.5/lib/mail/core_extensions/string.rb
depengine-0.0.24 etc/isolate/ruby-1.8/gems/mail-2.2.5/lib/mail/core_extensions/string.rb
depengine-0.0.23 etc/isolate/jruby-1.8/gems/mail-2.2.5/lib/mail/core_extensions/string.rb
depengine-0.0.23 etc/isolate/ruby-1.8/gems/mail-2.2.5/lib/mail/core_extensions/string.rb
depengine-0.0.22 etc/isolate/jruby-1.8/gems/mail-2.2.5/lib/mail/core_extensions/string.rb
depengine-0.0.22 etc/isolate/ruby-1.8/gems/mail-2.2.5/lib/mail/core_extensions/string.rb