You're working through a marketing campaign for humor website and they're looking for a fun interactive feature on piglatinizing comments. Harry our friendly test dev has already working with the marketing agency to determine the appropriate rules and requirements and built RSpec files for us!
Here's Wikipedia's description of the rules for more context:
For words that begin with vowel sounds or silent letter, "way" is added at the end of the word. Examples are
- "egg" → "eggway"
- "inbox" → "inboxway"
- "eight" → "eightway"
For words that begin with consonant sounds, the initial consonant or consonant cluster is moved to the end of the word, and "ay" is added, as in the following examples:
- "happy" → "appyhay"
- "duck" → "uckday"
- "glove" → "oveglay"
The letter 'y' can play the role of either consonant or vowel, depending on its location
- "yellow" → "ellowyay"
- "rhythm" → "ythmrhay"
How do you deal with words starting with "qu" or "squ" ?
- "queen" → "eenquay"
- "squeal" → "ealsquay"