I hereby claim:
- I am aniki21 on github.
- I am demondownload (https://keybase.io/demondownload) on keybase.
- I have a public key ASCX0_oe6Sq4bvEnpbNEyKPGm8Utx8xaJy-fncYb0OK28wo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
# Count syllables in a word | |
# Based on this StackOverflow answer by Pesto: | |
# http://stackoverflow.com/a/1272072/245447 | |
def syllable_count(word) | |
word = word.downcase | |
return 1 if word.length <= 3 | |
word.sub!(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/, '') | |
word.sub!(/^y/, '') | |
word.scan(/[aeiouy]{1,2}/).size |
def roll(_roll = "") | |
# Roll a d6 by default if nothing else is specified | |
if roll == "" | |
return rand(6) + 1 | |
end | |
dice,mod = _roll.split("+").map(&:strip) | |
count,sides = dice.split("d").map(&:strip) | |
total = 0 |