Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit 2780506

Browse files
committed
Merge pull request #44 from jordoh/handle_nil_prefix
Update starts/ends_with? to handle nil prefix
2 parents e152ab9 + beee5e8 commit 2780506

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

lib/openid/extras.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
class String
22
def starts_with?(other)
3+
other = other.to_s
34
head = self[0, other.length]
45
head == other
56
end
67

78
def ends_with?(other)
9+
other = other.to_s
810
tail = self[-1 * other.length, other.length]
911
tail == other
1012
end

0 commit comments

Comments
 (0)