ruby - bob
This commit is contained in:
18
ruby/bob/bob.rb
Normal file
18
ruby/bob/bob.rb
Normal 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
|
Reference in New Issue
Block a user