#!/bin/ruby module Ex25 # This function will break up words for us. def self.break_words(stuff) words = stuff.split(" ") words end # Sorts the words. def self.sort_words(words) words = words.sort() words end # Prints the first word after shifting one back. def self.print_first_word(words) word = words.shift() puts word end # Prints the last word after popping it off. def self.print_last_word(words) word = words.pop() puts word end # Takes in a full sentence and returns the sorted words. def self.sort_sentence(sentence) words = break_words(sentence) words = sort_words(words) words end # Prints the first and last words of the sentence. def self.print_first_last(sentence) words = break_words(sentence) print_first_word(words) print_last_word(words) end # Sorts the words then prints the first and last one. def self.print_first_last_sorted(sentence) words = sort_sentence(sentence) print_first_word(words) print_last_word(words) end # Break it, pop a couple off the end and add fucker to the end, than return new sentence. def self.add_fucker(sentence) words = break_words(sentence) word = 2.times do words.pop() end sentence = words.join(" ") sentence = sentence + " fuckers." puts sentence sentence end # Shift 4 off the beginning, add death and put back together. Return new sentence. def self.add_death(sentence) words = break_words(sentence) word = 4.times do words.shift() end sentence = words.join(" ") death = "Death will " sentence = death + sentence puts sentence sentence end # Combines the two end changes above and prints out. def self.change_sentence(sentence) sentence = add_fucker(sentence) sentence puts "\n" puts "Than the other half:" sentence = add_death(sentence) puts "\n" sentence end end puts "\n" puts "Let's practice everyfuckingthing." puts "\n" poem = <