File: extras.rb

package info (click to toggle)
ruby-openid 2.1.8debian-6
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,676 kB
  • sloc: ruby: 16,506; xml: 219; sh: 24; makefile: 2
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