Sha256: 0570656f3454ad4fe41af48844a96ec1e4f6a30eb0b3c124f2f741b670a81aac

Contents?: true

Size: 657 Bytes

Versions: 122

Compression:

Stored size: 657 Bytes

Contents

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

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

  unless String.instance_methods(false).map {|m| m.to_sym}.include?(:blank?)
    def blank?
      self !~ /\S/
    end
  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

122 entries across 110 versions & 12 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/mail-2.4.4/lib/mail/core_extensions/string.rb
classiccms-0.7.4 vendor/bundle/gems/mail-2.4.4/lib/mail/core_extensions/string.rb
classiccms-0.7.3 vendor/bundle/gems/mail-2.4.4/lib/mail/core_extensions/string.rb
active_mailer-0.0.10 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/core_extensions/string.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/mail-2.4.4/lib/mail/core_extensions/string.rb
classiccms-0.7.2 vendor/bundle/gems/mail-2.4.4/lib/mail/core_extensions/string.rb
classiccms-0.7.1 vendor/bundle/gems/mail-2.4.4/lib/mail/core_extensions/string.rb
active_mailer-0.0.9 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/core_extensions/string.rb
active_mailer-0.0.8 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/core_extensions/string.rb
active_mailer-0.0.7 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/core_extensions/string.rb
active_mailer-0.0.6 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/core_extensions/string.rb
classiccms-0.7.0 vendor/bundle/gems/mail-2.4.4/lib/mail/core_extensions/string.rb
challah-1.0.0.beta3 vendor/bundle/gems/mail-2.5.3/lib/mail/core_extensions/string.rb
fc-webicons-0.0.4 vendor/bundle/ruby/1.9.1/gems/mail-2.5.3/lib/mail/core_extensions/string.rb
challah-1.0.0.beta2 vendor/bundle/gems/mail-2.5.3/lib/mail/core_extensions/string.rb
challah-1.0.0.beta vendor/bundle/gems/mail-2.4.4/lib/mail/core_extensions/string.rb
challah-1.0.0.beta vendor/bundle/gems/mail-2.5.3/lib/mail/core_extensions/string.rb
fc-webicons-0.0.3 vendor/bundle/ruby/1.9.1/gems/mail-2.5.3/lib/mail/core_extensions/string.rb
fc-webicons-0.0.2 vendor/bundle/ruby/1.9.1/gems/mail-2.5.3/lib/mail/core_extensions/string.rb
fc-webicons-0.0.1 vendor/bundle/ruby/1.9.1/gems/mail-2.5.3/lib/mail/core_extensions/string.rb