Skip to content

Instantly share code, notes, and snippets.

@sixtyfive
Last active May 20, 2022 09:45
Show Gist options
  • Save sixtyfive/54bfcaea43edb5e2a5c0241f32d18dce to your computer and use it in GitHub Desktop.
Save sixtyfive/54bfcaea43edb5e2a5c0241f32d18dce to your computer and use it in GitHub Desktop.
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