moduleEx25# This function will break up words for us.defEx25.break_words(stuff)words=stuff.split(' ')returnwordsend# Sorts the words.defEx25.sort_words(words)returnwords.sortend# Prints the first word after popping it off.defEx25.print_first_word(words)word=words.shiftputswordend# Prints the last word after popping it off.defEx25.print_last_word(words)word=words.popputswordend# Takes in a full sentence and returns the sorted words.defEx25.sort_sentence(sentence)words=Ex25.break_words(sentence)returnEx25.sort_words(words)end# Prints the first and last words of the sentence.defEx25.print_first_and_last(sentence)words=Ex25.break_words(sentence)Ex25.print_first_word(words)Ex25.print_last_word(words)end# Sorts the words then prints the first and last one.defEx25.print_first_and_last_sorted(sentence)words=Ex25.sort_sentence(sentence)Ex25.print_first_word(words)Ex25.print_last_word(words)endendputs"Let's practice everything."puts'You\'d need to know \'bout escapes with \\ that do \n newlines and \t tabs.'poem=<<END\tThe lovely world
with logic so firmly planted
cannot discern \n the needs of love
nor comprehend passion from intuition
and requires an explanation
\n\t\twhere there is none.
ENDputs"--------------"putspoemputs"--------------"five=10-2+3-6puts"This should be five: #{five}"defsecret_formula(started)jelly_beans=started*500jars=jelly_beans/1000crates=jars/100returnjelly_beans,jars,cratesendstart_point=10000beans,jars,crates=secret_formula(start_point)puts"With a starting point of: #{start_point}"puts"We'd have #{beans} beans, #{jars} jars, and #{crates} crates."start_point=start_point/10sentence="All good things come to those who wait."words=Ex25.break_words(sentence)sorted_words=Ex25.sort_words(words)Ex25.print_first_word(words)Ex25.print_last_word(words)Ex25.print_first_word(sorted_words)Ex25.print_last_word(sorted_words)sorted_words=Ex25.sort_sentence(sentence)Ex25.print_first_and_last(sentence)Ex25.print_first_and_last_sorted(sentence)