Class: Magic8Ball

Inherits:
Object
  • Object
show all
Defined in:
lib/magic_8_ball.rb

Overview

lib/magic_8_ball.rb

Constant Summary collapse

POSITIVE =
['It is certain', 'It is decidedly so', 'Without a doubt',
'Yes, definitely', 'You may rely on it', 'As I see it, yes',
'Most likely', 'Outlook good', 'Yes', 'Signs point to yes']
NEGATIVE =
["Don't count on it", 'My reply is no', 'My sources say no',
'Outlook not so good', 'Very doubtful']
NEUTRAL =
['Reply hazy try again', 'Ask again later',
'Better not tell you now', 'Cannot predict now',
'Concentrate and ask again']

Class Method Summary collapse

Class Method Details

.answerObject



23
24
25
# File 'lib/magic_8_ball.rb', line 23

def self.answer
  (POSITIVE + NEGATIVE + NEUTRAL).sample
end

.negative_answerObject



15
16
17
# File 'lib/magic_8_ball.rb', line 15

def self.negative_answer
  NEGATIVE.sample
end

.neutral_answerObject



19
20
21
# File 'lib/magic_8_ball.rb', line 19

def self.neutral_answer
  NEUTRAL.sample
end

.positive_answerObject



11
12
13
# File 'lib/magic_8_ball.rb', line 11

def self.positive_answer
  POSITIVE.sample
end