Sha256: fe2e9170b7abc4d513e7f17fa1c41450def5ecbbc7117244f3e7ba7a800cf35a

Contents?: true

Size: 296 Bytes

Versions: 12

Compression:

Stored size: 296 Bytes

Contents

class String
  # Returns true iff +other+ appears exactly at the start of +self+.
  def starts_with? other
    self[0, other.length] == other
  end

  # Returns true iff +other+ appears exactly at the end of +self+.
  def ends_with? other
    self[-other.length, other.length] == other
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
cloudist-0.5.0 lib/cloudist/core_ext/string.rb
cloudist-0.4.4 lib/cloudist/core_ext/string.rb
cloudist-0.4.3 lib/cloudist/core_ext/string.rb
cloudist-0.4.2 lib/cloudist/core_ext/string.rb
cloudist-0.4.1 lib/cloudist/core_ext/string.rb
cloudist-0.2.1 lib/cloudist/core_ext/string.rb
cloudist-0.2.0 lib/cloudist/core_ext/string.rb
cloudist-0.1.2 lib/cloudist/core_ext/string.rb
cloudist-0.1.1 lib/cloudist/core_ext/string.rb
cloudist-0.1.0 lib/cloudist/core_ext/string.rb
cloudist-0.0.3 lib/cloudist/core_ext/string.rb
cloudist-0.0.2 lib/cloudist/core_ext/string.rb