cryptozoologist 1.1.0 → 1.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 570fbd64cf5f220a49071fcae1c81caf6bc326a5
4
- data.tar.gz: ea5573d3408e45bef12310f760411b69c953521d
3
+ metadata.gz: 617e16efb3ef19c2cadea0e7c406f0c16caefa78
4
+ data.tar.gz: 1f470c1847c3884bd056a7d7d0f16e19761e7368
5
5
  SHA512:
6
- metadata.gz: 63aa97f9b8549b968191af3969eb9f8f3a90cb7ba083a9bd6f7cf2603f993e465e6b81de09c9d955552fd49c7200472408f381312d6992bd0f091ca5c475ae23
7
- data.tar.gz: b23288082ac4e9386c6c40ad78549260fb6c20ee8f920ffc5adc5ecabd2659f56e7280ebbc187fb3e6c58be14997b5429ac2f4ebee2d12ffb01737e1b823933f
6
+ metadata.gz: b2dcce49319a8f510e39b05779a1fcd82ab93d09b33de4cda6e642bff72799635bfa3509ab3f78517d040a00f3e837da06d91e7d4a206857ad031160e3aa25bc
7
+ data.tar.gz: 44ebe7f46dff33009349302398cfc219316a3c9f740ee3270e7d7281fe7ba1a58a5700af6d5790eac5f2abbd2d2b6eedb3f4a24b8bde19e6b386ba7715a1bf89
data/CHANGELOG.md CHANGED
@@ -3,4 +3,8 @@
3
3
  ## 1.1.0
4
4
 
5
5
  - add `Configuration` options to exclude dictionaries
6
- - bump Ruby to 2.3.1
6
+ - bump Ruby to 2.3.1
7
+
8
+ ## 1.2.0
9
+
10
+ - add `colors` dictionary with `:paint` and `:web` options
data/README.md CHANGED
@@ -28,24 +28,39 @@ Or install it yourself as:
28
28
 
29
29
  Right now, this gem doesn't do much of anything except over architect a series of word lists.
30
30
 
31
- **Get a random animal:**
31
+ **Available word lists**
32
32
 
33
- dictionary = Cryptozoologist::Dictionary.new
34
- animals = dictionary.animals
35
- animals.sample # => "sun bear"
33
+ - colors
34
+ - animals
36
35
 
37
- **Exclude animal types:**
36
+ **Configuration options**
38
37
 
39
- Valid types to exclude;
38
+ Exclude:
40
39
 
41
- - `:common`
42
- - `:mythical`
40
+ - animals:
41
+ - `:common`, `:mythical`
42
+ - colors:
43
+ - `:paint`, `:web`
43
44
 
44
- *Note:* you can only exclude one or you wan't have any animals!
45
+ *Note:* you can only exclude one of each or you won't have any words in your list!
46
+
47
+ **Example**
45
48
 
46
49
  Cryptozoologist.configurre do |config|
47
- configu.exclude = [:common]
50
+ config.exclude = [:common]
48
51
  end
49
52
  dictionary = Cryptozoologist::Dictionary.new
50
53
  animals = dictionary.animals
51
- animals.sample # => "crumple horned snorkack"
54
+ animals.sample # => "crumple horned snorkack"
55
+
56
+ **Get a random animal**
57
+
58
+ dictionary = Cryptozoologist::Dictionary.new
59
+ animals = dictionary.animals
60
+ animals.sample # => "sun bear"
61
+
62
+ **Get a random color**
63
+
64
+ dictionary = Cryptozoologist::Dictionary.new
65
+ colors = dictionary.colors
66
+ colors.sample # => "pink"
@@ -14,7 +14,9 @@ module Cryptozoologist
14
14
 
15
15
  private
16
16
  def valid_exclusions
17
- Cryptozoologist.dictionaries.keys
17
+ keys = []
18
+ Cryptozoologist.dictionaries.each { |key, value| keys += value.keys }
19
+ keys
18
20
  end
19
21
  end
20
22
  end
@@ -3,20 +3,35 @@ module Cryptozoologist
3
3
  extend self
4
4
 
5
5
  def animals
6
- list = []
7
- filtered.each { |word_bank| list << word_bank.list }
8
- list.flatten
6
+ create_list(:animals)
7
+ end
8
+
9
+ def colors
10
+ create_list(:colors)
9
11
  end
10
12
 
11
13
  def library
12
14
  {
13
- common: Animals::Common,
14
- mythical: Animals::Mythical
15
+ animals: {
16
+ common: Animals::Common,
17
+ mythical: Animals::Mythical
18
+ },
19
+ colors: {
20
+ paint: Colors::Paint,
21
+ web: Colors::WebSafe
22
+ }
15
23
  }
16
24
  end
17
25
 
18
- private def filtered
19
- dictionaries = library.reject do |key, value|
26
+ private
27
+ def create_list(key)
28
+ list = []
29
+ filter_library(key).each { |word_bank| list << word_bank.list }
30
+ list.flatten
31
+ end
32
+
33
+ def filter_library(key)
34
+ dictionaries = library[key].reject do |key, value|
20
35
  Cryptozoologist.configuration.exclude.include?(key)
21
36
  end
22
37
  dictionaries.values
@@ -0,0 +1,66 @@
1
+ module Cryptozoologist
2
+ module Dictionaries
3
+ module Colors
4
+ module Paint
5
+ def self.list
6
+ [
7
+ "hugs and kisses",
8
+ "mayonnaise",
9
+ "potentially purple",
10
+ "dragon blood",
11
+ "mermaid net",
12
+ "song of summer",
13
+ "bath salts",
14
+ "friendship",
15
+ "flamingo dream",
16
+ "salty tear",
17
+ "practical beige",
18
+ "whispering peach",
19
+ "anonymous",
20
+ "emotional",
21
+ "spirit whisper",
22
+ "phantom mist",
23
+ "rave red",
24
+ "magic potion",
25
+ "silver fox",
26
+ "winter wolf",
27
+ "divine pleasure",
28
+ "new age",
29
+ "bagel",
30
+ "nacho cheese",
31
+ "magic school bus",
32
+ "centaur",
33
+ "obstinate orange",
34
+ "seduction",
35
+ "gray area",
36
+ "new london burgundy",
37
+ "buxton blue",
38
+ "bachelor blue",
39
+ "red red wine",
40
+ "dream i can fly",
41
+ "lavender secret",
42
+ "dinner mint",
43
+ "cheerful whisper",
44
+ "likeable sand",
45
+ "appletini",
46
+ "frozen in time",
47
+ "subtle touch",
48
+ "cottage green",
49
+ "absolute zero",
50
+ "lambskin",
51
+ "old canal",
52
+ "polar drift",
53
+ "clear pond",
54
+ "washed khaki",
55
+ "chantilly",
56
+ "falling snow",
57
+ "cherry tart",
58
+ "pyramid gold",
59
+ "oregano spice",
60
+ "prarie poppy"
61
+ ]
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,153 @@
1
+ module Cryptozoologist
2
+ module Dictionaries
3
+ module Colors
4
+ module WebSafe
5
+ def self.list
6
+ [
7
+ "alice blue",
8
+ "antique white",
9
+ "aqua",
10
+ "aquamarine",
11
+ "azure",
12
+ "beige",
13
+ "bisque",
14
+ "black",
15
+ "blanched almond",
16
+ "blue",
17
+ "blue violet",
18
+ "brown",
19
+ "burly wood",
20
+ "cadet blue",
21
+ "chartreuse",
22
+ "chocolate",
23
+ "coral",
24
+ "cornflower blue",
25
+ "cornsilk",
26
+ "crimson",
27
+ "cyan",
28
+ "dark blue",
29
+ "dark cyan",
30
+ "dark golden rod",
31
+ "dark gray",
32
+ "dark green",
33
+ "dark khaki",
34
+ "dark magenta",
35
+ "dark olive green",
36
+ "dark orange",
37
+ "dark orchid",
38
+ "dark red",
39
+ "dark salmon",
40
+ "dark seagreen",
41
+ "dark slate blue",
42
+ "dark slate gray",
43
+ "dark turquoise",
44
+ "dark violet",
45
+ "deep pink",
46
+ "deep sky blue",
47
+ "dim gray",
48
+ "dodger blue",
49
+ "fire brick",
50
+ "floral white",
51
+ "forest green",
52
+ "fuchsia",
53
+ "gainsboro",
54
+ "ghost white",
55
+ "gold",
56
+ "golden rod",
57
+ "gray",
58
+ "green",
59
+ "green yellow",
60
+ "honey dew",
61
+ "hot pink",
62
+ "indian red",
63
+ "indigo",
64
+ "ivory",
65
+ "khaki",
66
+ "lavender",
67
+ "lavender blush",
68
+ "lawn green",
69
+ "lemon chiffon",
70
+ "light blue",
71
+ "light coral",
72
+ "light cyan",
73
+ "light golden rod yellow",
74
+ "light gray",
75
+ "light green",
76
+ "light pink",
77
+ "light salmon",
78
+ "light sea green",
79
+ "light sky blue",
80
+ "light slate gray",
81
+ "light steel blue",
82
+ "light yellow",
83
+ "lime",
84
+ "lime green",
85
+ "linen",
86
+ "magenta",
87
+ "maroon",
88
+ "medium aqua marine",
89
+ "medium blue",
90
+ "medium orchid",
91
+ "medium purple",
92
+ "medium sea green",
93
+ "medium slate blue",
94
+ "medium spring green",
95
+ "medium turquoise",
96
+ "medium violet red",
97
+ "midnight blue",
98
+ "mint cream",
99
+ "misty rose",
100
+ "moccasin",
101
+ "navajo white",
102
+ "navy",
103
+ "old lace",
104
+ "olive",
105
+ "olive drab",
106
+ "orange",
107
+ "orange red",
108
+ "orchid",
109
+ "pale golden rod",
110
+ "pale green",
111
+ "pale turquoise",
112
+ "pale violet red",
113
+ "papaya whip",
114
+ "peach puff",
115
+ "peru",
116
+ "pink",
117
+ "plum",
118
+ "powder blue",
119
+ "purple",
120
+ "rebecca purple",
121
+ "red",
122
+ "rosy brown",
123
+ "royal blue",
124
+ "saddle brown",
125
+ "salmon",
126
+ "sandy brown",
127
+ "sea green",
128
+ "sea shell",
129
+ "sienna",
130
+ "silver",
131
+ "sky blue",
132
+ "slate blue",
133
+ "slate gray",
134
+ "snow",
135
+ "spring green",
136
+ "steel blue",
137
+ "tan",
138
+ "teal",
139
+ "thistle",
140
+ "tomato",
141
+ "turquoise",
142
+ "violet",
143
+ "wheat",
144
+ "white",
145
+ "white smoke",
146
+ "yellow",
147
+ "yellow green"
148
+ ]
149
+ end
150
+ end
151
+ end
152
+ end
153
+ end
@@ -2,6 +2,7 @@ module Cryptozoologist
2
2
  class Dictionary
3
3
  def initialize
4
4
  @animals = []
5
+ @colors = []
5
6
  end
6
7
 
7
8
  def animals
@@ -9,5 +10,11 @@ module Cryptozoologist
9
10
  @animals = Dictionaries.animals
10
11
  @animals
11
12
  end
13
+
14
+ def colors
15
+ @colors if @colors.any?
16
+ @colors = Dictionaries.colors
17
+ @colors
18
+ end
12
19
  end
13
20
  end
@@ -1,3 +1,3 @@
1
1
  module Cryptozoologist
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -1,7 +1,19 @@
1
1
  require_relative '../spec_helper'
2
2
 
3
3
  describe Cryptozoologist::Dictionaries do
4
- context '#words' do
4
+ context '#libraries' do
5
+ it 'contains animals' do
6
+ keys = Cryptozoologist::Dictionaries.library[:animals].keys
7
+ expect(keys.length).to eq(2)
8
+ end
9
+
10
+ it 'contains colors' do
11
+ keys = Cryptozoologist::Dictionaries.library[:colors].keys
12
+ expect(keys.length).to eq(2)
13
+ end
14
+ end
15
+
16
+ context '#animals' do
5
17
  it 'has a word list' do
6
18
  expect(Cryptozoologist::Dictionaries.animals.length).to be > 1
7
19
  end
@@ -15,5 +27,49 @@ describe Cryptozoologist::Dictionaries do
15
27
  mythical = Cryptozoologist::Dictionaries::Animals::Mythical.list
16
28
  expect(Cryptozoologist::Dictionaries.animals.include?(mythical.sample)).to be true
17
29
  end
30
+
31
+ it 'does not contain other types of words' do
32
+ list = Cryptozoologist::Dictionaries::Animals::Common.list
33
+ list += Cryptozoologist::Dictionaries::Animals::Mythical.list
34
+ expect(list.sort).to eq(Cryptozoologist::Dictionaries.animals.sort)
35
+ end
36
+
37
+ it 'filters out exclusions' do
38
+ Cryptozoologist.configure do |config|
39
+ config.exclude = [:mythical]
40
+ end
41
+ mythical = Cryptozoologist::Dictionaries::Animals::Mythical.list
42
+ expect(Cryptozoologist::Dictionaries.animals.include?(mythical.sample)).to be_falsy
43
+ end
44
+ end
45
+
46
+ context '#colors' do
47
+ it 'has a color list' do
48
+ expect(Cryptozoologist::Dictionaries.colors.length).to be > 1
49
+ end
50
+
51
+ it 'contains paint colors' do
52
+ paint = Cryptozoologist::Dictionaries::Colors::Paint.list
53
+ expect(Cryptozoologist::Dictionaries.colors.include?(paint.sample)).to be true
54
+ end
55
+
56
+ it 'contains web colors' do
57
+ web = Cryptozoologist::Dictionaries::Colors::WebSafe.list
58
+ expect(Cryptozoologist::Dictionaries.colors.include?(web.sample)).to be true
59
+ end
60
+
61
+ it 'does not contain other types of words' do
62
+ list = Cryptozoologist::Dictionaries::Colors::Paint.list
63
+ list += Cryptozoologist::Dictionaries::Colors::WebSafe.list
64
+ expect(list.sort).to eq(Cryptozoologist::Dictionaries.colors.sort)
65
+ end
66
+
67
+ it 'filters out exclusions' do
68
+ Cryptozoologist.configure do |config|
69
+ config.exclude = [:paint]
70
+ end
71
+ paint = Cryptozoologist::Dictionaries::Colors::Paint.list
72
+ expect(Cryptozoologist::Dictionaries.colors.include?(paint.sample)).to be_falsy
73
+ end
18
74
  end
19
75
  end
@@ -5,17 +5,35 @@ describe Cryptozoologist::Dictionary do
5
5
  @dictionary = Cryptozoologist::Dictionary.new
6
6
  end
7
7
 
8
- it 'has an animal list' do
9
- expect(@dictionary.animals.length).to be > 1
10
- end
8
+ context '#animals' do
9
+ it 'has an animal list' do
10
+ expect(@dictionary.animals.length).to be > 1
11
+ end
12
+
13
+ it 'contains Common animals' do
14
+ common = Cryptozoologist::Dictionaries::Animals::Common.list
15
+ expect(@dictionary.animals.include?(common.sample)).to be true
16
+ end
11
17
 
12
- it 'contains Common animals' do
13
- common = Cryptozoologist::Dictionaries::Animals::Common.list
14
- expect(@dictionary.animals.include?(common.sample)).to be true
18
+ it 'contains Mythical creatures' do
19
+ mythical = Cryptozoologist::Dictionaries::Animals::Mythical.list
20
+ expect(@dictionary.animals.include?(mythical.sample)).to be true
21
+ end
15
22
  end
16
23
 
17
- it 'contains Mythical creatures' do
18
- mythical = Cryptozoologist::Dictionaries::Animals::Mythical.list
19
- expect(@dictionary.animals.include?(mythical.sample)).to be true
24
+ context '#colors' do
25
+ it 'has a color list' do
26
+ expect(@dictionary.colors.length).to be > 1
27
+ end
28
+
29
+ it 'contains paint colors' do
30
+ paint = Cryptozoologist::Dictionaries::Colors::Paint.list
31
+ expect(@dictionary.colors.include?(paint.sample)).to be true
32
+ end
33
+
34
+ it 'contains web colors' do
35
+ web = Cryptozoologist::Dictionaries::Colors::WebSafe.list
36
+ expect(@dictionary.colors.include?(web.sample)).to be true
37
+ end
20
38
  end
21
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cryptozoologist
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liz Abinante
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-08 00:00:00.000000000 Z
11
+ date: 2016-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.11'
19
+ version: '1.12'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.11'
26
+ version: '1.12'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -99,6 +99,8 @@ files:
99
99
  - lib/cryptozoologist/dictionaries.rb
100
100
  - lib/cryptozoologist/dictionaries/animals/common.rb
101
101
  - lib/cryptozoologist/dictionaries/animals/mythical.rb
102
+ - lib/cryptozoologist/dictionaries/colors/paint.rb
103
+ - lib/cryptozoologist/dictionaries/colors/web_safe.rb
102
104
  - lib/cryptozoologist/dictionary.rb
103
105
  - lib/cryptozoologist/errors.rb
104
106
  - lib/cryptozoologist/version.rb