Sha256: bceee7d68568c898f52e86571ed639a34fdda4b8a98734a2386181277801168f

Contents?: true

Size: 829 Bytes

Versions: 36

Compression:

Stored size: 829 Bytes

Contents

# frozen_string_literal: true

require_relative 'highlight'
require_relative 'query'
require_relative 'tags'
require_relative 'transform'
require_relative 'truncate'
require_relative 'url'

class ::String
  include Doing::Color
  include Doing::StringHighlight
  include Doing::StringQuery
  include Doing::StringTags
  include Doing::StringTransform
  include Doing::StringTruncate
  include Doing::StringURL

  ##
  ## Test if string is a valid 32-character MD5 id
  ##
  ## @return     [Boolean] string is valid identifier
  ##
  def valid_id?
    strip =~ /^[a-z0-9]{32}$/ ? true : false
  end

  ##
  ## Force UTF-8 encoding if available
  ##
  ## @return     [String] UTF-8 encoded string
  ##
  def utf8
    if String.method_defined? :force_encoding
      dup.force_encoding('utf-8')
    else
      self
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
doing-2.1.88 lib/doing/string/string.rb
doing-2.1.87 lib/doing/string/string.rb
doing-2.1.86 lib/doing/string/string.rb
doing-2.1.85 lib/doing/string/string.rb
doing-2.1.84 lib/doing/string/string.rb
doing-2.1.83 lib/doing/string/string.rb
doing-2.1.82 lib/doing/string/string.rb
doing-2.1.81 lib/doing/string/string.rb
doing-2.1.80 lib/doing/string/string.rb
doing-2.1.79 lib/doing/string/string.rb
doing-2.1.78 lib/doing/string/string.rb
doing-2.1.77 lib/doing/string/string.rb
doing-2.1.76 lib/doing/string/string.rb
doing-2.1.75 lib/doing/string/string.rb
doing-2.1.74 lib/doing/string/string.rb
doing-2.1.73 lib/doing/string/string.rb
doing-2.1.72 lib/doing/string/string.rb
doing-2.1.69 lib/doing/string/string.rb
doing-2.1.68 lib/doing/string/string.rb
doing-2.1.66 lib/doing/string/string.rb