-
-
Save sixtyfive/54bfcaea43edb5e2a5c0241f32d18dce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module CoreExtensions | |
refine String do | |
def titlecase | |
s = chars | |
s.map.with_index{|c,i| | |
!%w[a i u].include?(s[0]) && ((i==0 && self[0..1] != 'al') || (i==1 && %w[ʾ ʿ].include?(s[0]))) ? | |
c.upcase : | |
c | |
}.join | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment