Sha256: 9775505ad360fb441510cd689414761da874ec3c44f5af35653a3c093c23080b

Contents?: true

Size: 979 Bytes

Versions: 10

Compression:

Stored size: 979 Bytes

Contents

class String

  # Return true if the string is capitalized, otherwise false.
  #
  #   "This".capitalized?  #=> true
  #   "THIS".capitalized?  #=> false
  #   "this".capitalized?  #=> false
  #
  # Note Ruby's strange concept of capitalized. See capitalcase
  # for the more command conception.
  #
  # CREDIT: Phil Tomson

  def capitalized?
    capitalize == self
  end

  # Return true if the string is lowercase (downcase), otherwise false.
  #
  #   "THIS".downcase?  #=> false
  #   "This".downcase?  #=> false
  #   "this".downcase?  #=> true
  #
  # CREDIT: Phil Tomson

  def downcase?
    downcase == self
  end

  # Alias for #downcase? method.
  # alias_method :lowercase?, :downcase?

  # Is the string upcase/uppercase?
  #
  #   "THIS".upcase?  #=> true
  #   "This".upcase?  #=> false
  #   "this".upcase?  #=> false
  #
  # CREDIT: Phil Tomson

  def upcase?
    upcase == self
  end

  # Alias for #upcase? method.
  # alias_method :uppercase?, :upcase?

end

Version data entries

10 entries across 9 versions & 2 rubygems

Version Path
facets-glimmer-3.2.0 lib/core/facets/string/capitalized.rb
facets-3.1.0 lib/core/facets/string/capitalized.rb
facets-3.0.0 lib/core/facets/string/capitalized.rb
facets-2.9.3 lib/core/facets/string/capitalized.rb
facets-2.9.2 lib/core/facets/string/capitalized.rb
facets-2.9.2 src/core/facets/string/capitalized.rb
facets-2.9.1 lib/core/facets/string/capitalized.rb
facets-2.9.0 lib/core/facets/string/capitalized.rb
facets-2.9.0.pre.2 lib/core/facets/string/capitalized.rb
facets-2.9.0.pre.1 lib/core/facets/string/capitalized.rb