Skip to content

Instantly share code, notes, and snippets.

@alexch
Created May 8, 2012 16:37
Show Gist options
  • Select an option

  • Save alexch/2637074 to your computer and use it in GitHub Desktop.

Select an option

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

sramshey commented May 8, 2012

Copy link
Copy Markdown

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