File: extras.rb

package info (click to toggle)
libopenid-ruby 2.1.8debian-1%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 5,300 kB
  • ctags: 3,346
  • sloc: ruby: 17,403; xml: 219; sh: 78; python: 30; makefile: 15
file content (11 lines) | stat: -rw-r--r-- 198 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
class String
  def starts_with?(other)
    head = self[0, other.length]
    head == other
  end

  def ends_with?(other)
    tail = self[-1 * other.length, other.length]
    tail == other
  end
end