Skip to content

Instantly share code, notes, and snippets.

@alexch
Created May 8, 2012 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexch/2637074 to your computer and use it in GitHub Desktop.
Save alexch/2637074 to your computer and use it in GitHub Desktop.
Bootcamp Share
def translate(str)
tr_words = []
words = str.split
words.each do |word|
if word =~ /^([bcdfghjklmnpqrstvwxz]+)(.*)/
p word
p $1
p $2
tr_words.push($2 + $1 + "ay")
else
tr_words.push(word + "ay")
end
end
tr_words.join(" ")
end
@sramshey
Copy link

sramshey commented May 8, 2012

def translate(str)
tr_words = []
words = str.split
words.each do |word|
if word =~ /^([bcdfghjklmnpqrstvwxz]+)(.*)/
p word
p $1
p $2
tr_words.push($2 + $1 + "ay")
else
tr_words.push(word + "ay")
end
end
tr_words.join(" ")
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment