ruby - bob

This commit is contained in:
2018-09-19 11:01:30 -04:00
parent 0489fdc1af
commit e31b976368
3 changed files with 217 additions and 0 deletions

18
ruby/bob/bob.rb Normal file
View File

@@ -0,0 +1,18 @@
class Bob
def self.hey(remark)
remark.gsub!(/[[:space:]]+/, '')
if remark == ''
'Fine. Be that way!'
elsif remark.upcase == remark and remark =~ /[A-Za-z]+/
if remark[-1] == '?'
"Calm down, I know what I'm doing!"
else
'Whoa, chill out!'
end
elsif remark[-1] == '?'
'Sure.'
else
'Whatever.'
end
end
end