class Project::Caveman
Constants
- SUBSTITUTES
Public Instance Methods
call()
click to toggle source
# File lib/caveman.rb, line 26 def call greet_user loop do take_input break if @input == 'exit' puts sub_string end end
greet_user()
click to toggle source
# File lib/caveman.rb, line 18 def greet_user puts "you talk. me repeat. say exit, me quit." end
sub_string()
click to toggle source
# File lib/caveman.rb, line 12 def sub_string new_string = @input SUBSTITUTES.each {|word, replacement| new_string = new_string.gsub(/\b#{word}\b/, replacement)} "grunt...#{new_string.downcase}" end
take_input()
click to toggle source
# File lib/caveman.rb, line 22 def take_input @input = gets.strip end