magic-eightball 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/lib/magic_eightball.rb +43 -0
- data/magic_eightball.gemspec +15 -0
- data/spec/magic_eightball_spec.rb +44 -0
- metadata +49 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 74223507f3242b6435262025c16fe29d1faccf09
|
4
|
+
data.tar.gz: eb6f46dbf3af412f87d9a68ca35b67196b1c3a1c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ff1a6deb723e2bc2d278106ec7208bbd36d23a63591c7079f0031d0f8b9a4b87acf8fa58da4c301bfb8485b6fe0ccdc9fda6c0cb8fc2e76ca13f991f44312804
|
7
|
+
data.tar.gz: f2c8118ca50237ae2cf5a8f8bd784ba606f0ea18fe4499f236b6f039124c30443ec68429bb759d11a912d8745ad5d1c60a4ec5098b55491608d07820ff7f9afd
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
.idea
|
@@ -0,0 +1,43 @@
|
|
1
|
+
class MagicEightball
|
2
|
+
# Spread the Magic Eightball(tm) love across the world.
|
3
|
+
#
|
4
|
+
# Example:
|
5
|
+
# >> MagicEightball.shake
|
6
|
+
# => It is decidedly so
|
7
|
+
# >> MagicEightball.reply(:maybe)
|
8
|
+
# => Ask again later
|
9
|
+
#
|
10
|
+
|
11
|
+
@@options = [:yes, :maybe, :no]
|
12
|
+
|
13
|
+
@@eight_ball = {yes: ['It is certain',
|
14
|
+
'It is decidedly so',
|
15
|
+
'Without a doubt',
|
16
|
+
'Yes definitely',
|
17
|
+
'You may rely on it',
|
18
|
+
'As I see it, yes',
|
19
|
+
'Most likely',
|
20
|
+
'Outlook good',
|
21
|
+
'Yes',
|
22
|
+
'Signs point to yes'],
|
23
|
+
maybe: ['Reply hazy try again',
|
24
|
+
'Ask again later',
|
25
|
+
'Better not tell you now',
|
26
|
+
'Cannot predict now',
|
27
|
+
'Concentrate and ask again'],
|
28
|
+
no: ['Don\'t count on it',
|
29
|
+
'My reply is no',
|
30
|
+
'My sources say no',
|
31
|
+
'Outlook not so good',
|
32
|
+
'Very doubtful']}
|
33
|
+
|
34
|
+
def self.shake
|
35
|
+
@@eight_ball[@@options.sample].sample
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.reply(option)
|
39
|
+
if @@options.include? option
|
40
|
+
@@eight_ball[option].sample
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = 'magic-eightball'
|
3
|
+
spec.version = '0.0.1'
|
4
|
+
spec.authors = ['Andrew Kreps']
|
5
|
+
spec.email = ['andrew.kreps@gmail.com']
|
6
|
+
spec.description = %q{My sources say no.}
|
7
|
+
spec.summary = %q{Reply hazy, try again}
|
8
|
+
spec.homepage = 'https://github.com/onewheelskyward/magic-eightball'
|
9
|
+
spec.license = 'MIT'
|
10
|
+
|
11
|
+
spec.files = `git ls-files`.split($/)
|
12
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
13
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
14
|
+
spec.require_paths = ['lib']
|
15
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require_relative '../lib/magic_eightball'
|
3
|
+
|
4
|
+
describe 'Test the eightball' do
|
5
|
+
yesses = ['It is certain',
|
6
|
+
'It is decidedly so',
|
7
|
+
'Without a doubt',
|
8
|
+
'Yes definitely',
|
9
|
+
'You may rely on it',
|
10
|
+
'As I see it, yes',
|
11
|
+
'Most likely',
|
12
|
+
'Outlook good',
|
13
|
+
'Yes',
|
14
|
+
'Signs point to yes']
|
15
|
+
|
16
|
+
maybes = ['Reply hazy try again',
|
17
|
+
'Ask again later',
|
18
|
+
'Better not tell you now',
|
19
|
+
'Cannot predict now',
|
20
|
+
'Concentrate and ask again']
|
21
|
+
|
22
|
+
nos = ['Don\'t count on it',
|
23
|
+
'My reply is no',
|
24
|
+
'My sources say no',
|
25
|
+
'Outlook not so good',
|
26
|
+
'Very doubtful']
|
27
|
+
|
28
|
+
it 'will give me yes commands' do
|
29
|
+
expect(yesses).to include MagicEightball.reply(:yes)
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'will give me no commands' do
|
33
|
+
expect(nos).to include MagicEightball.reply(:no)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'will give me maybe commands' do
|
37
|
+
expect(maybes).to include MagicEightball.reply(:maybe)
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'will give me shake it off' do
|
41
|
+
expect(yesses + nos + maybes).to include MagicEightball.shake
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
metadata
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: magic-eightball
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrew Kreps
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-29 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: My sources say no.
|
14
|
+
email:
|
15
|
+
- andrew.kreps@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".gitignore"
|
21
|
+
- lib/magic_eightball.rb
|
22
|
+
- magic_eightball.gemspec
|
23
|
+
- spec/magic_eightball_spec.rb
|
24
|
+
homepage: https://github.com/onewheelskyward/magic-eightball
|
25
|
+
licenses:
|
26
|
+
- MIT
|
27
|
+
metadata: {}
|
28
|
+
post_install_message:
|
29
|
+
rdoc_options: []
|
30
|
+
require_paths:
|
31
|
+
- lib
|
32
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
requirements: []
|
43
|
+
rubyforge_project:
|
44
|
+
rubygems_version: 2.2.2
|
45
|
+
signing_key:
|
46
|
+
specification_version: 4
|
47
|
+
summary: Reply hazy, try again
|
48
|
+
test_files:
|
49
|
+
- spec/magic_eightball_spec.rb
|