fake_person 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa40be947d2994e79ba987f7385a3c4e9dc014fb
4
- data.tar.gz: d8800a50d9c5adbb22a386f40eba23c88e38d2b6
3
+ metadata.gz: 0065161946c5d55306c092ba55545c0e995b56dd
4
+ data.tar.gz: 7cba228886d2e997021199e05d362c285a071eec
5
5
  SHA512:
6
- metadata.gz: ee863685835d3c5f3b4864a73affaa3bb426f8411489578bd28438f134703292a168114dc8e182be9d939495b21bd089857210d7298319a0d3330d140588f920
7
- data.tar.gz: b322ae0440a2fc65f61849c0c94a4168fc9d7b8f592fe5b4c64a76ccb753e10a758d2ef89c51ad0dfa731d1f9b7309068d7bbbf842eea1d859968a33c3073f2b
6
+ metadata.gz: eb5d5eb7951503766edc13158912e40b8559f6fe943a48df8efce11afd94f79c9f36aa0f13eae3a00f88b1779cec804368b939cf775927891a0123a18ee43b5b
7
+ data.tar.gz: cc61f3cef91f6f703428ad5fbbb76c21e1a017ae4f780626ad533ad703c2b18cbf89bffddaeb01d693292126545ac57f27a32ec2e0b7707583feff0ef2983ec3
data/db/activities.txt ADDED
@@ -0,0 +1,43 @@
1
+ astronomy
2
+ bathing
3
+ camping
4
+ climbing
5
+ coding
6
+ debugging
7
+ dog racing
8
+ drinking
9
+ driving
10
+ figure skating
11
+ gaming
12
+ geocaching
13
+ gongoozing
14
+ hiking
15
+ homebrewing
16
+ jogging
17
+ juggling
18
+ kitesurfing
19
+ knitting
20
+ nordic skating
21
+ paintballing
22
+ painting
23
+ photography
24
+ playing chess
25
+ playing darts
26
+ puzzles
27
+ rambling
28
+ reading
29
+ roller skating
30
+ sailing
31
+ sewing
32
+ shooting
33
+ shopping
34
+ singing
35
+ slot-car racing
36
+ stamp collecting
37
+ taxidermy
38
+ training mice
39
+ trainspotting
40
+ visiting museums
41
+ watching television
42
+ writing
43
+ yo-yoing
data/db/foods.txt ADDED
@@ -0,0 +1,60 @@
1
+ apples
2
+ bacon
3
+ baked beans
4
+ basil
5
+ beer
6
+ biscuits
7
+ bloody mary
8
+ burritos
9
+ cake
10
+ calzone
11
+ cheese
12
+ chicken
13
+ chinese food
14
+ chips
15
+ chocolate
16
+ cider
17
+ coffee
18
+ cola
19
+ cornettos
20
+ cottage pie
21
+ courgettes
22
+ couscous
23
+ cream
24
+ crisps
25
+ crumbs off of the floor
26
+ curry
27
+ custard
28
+ dried fruit
29
+ fish fingers
30
+ ginger
31
+ ham
32
+ jam
33
+ lamb
34
+ lasagna
35
+ leeks
36
+ lemondade
37
+ lobster thermadore
38
+ marshmallows
39
+ mushrooms
40
+ mussels
41
+ oysters
42
+ pasta
43
+ peanuts
44
+ pears
45
+ pizza
46
+ popcorn
47
+ pork
48
+ potatoes
49
+ puff pastry
50
+ risotto
51
+ rum
52
+ salami
53
+ salmon
54
+ spaghetti
55
+ steak
56
+ stew
57
+ tea
58
+ tomatoes
59
+ veal
60
+ vodka
data/lib/fake_person.rb CHANGED
@@ -4,3 +4,6 @@ require 'fake_person/titles'
4
4
  require 'fake_person/username'
5
5
  require 'fake_person/date_of_birth'
6
6
  require 'fake_person/email'
7
+ require 'fake_person/activities'
8
+ require 'fake_person/foods'
9
+ require 'fake_person/likes'
@@ -0,0 +1,14 @@
1
+ class FakePerson
2
+
3
+ def favourite_activity
4
+ @favourite_activity ||= self.class.activities.sample
5
+ end
6
+
7
+ def self.activities
8
+ @activities ||= begin
9
+ path = File.expand_path(File.join('..', '..', '..', 'db', "activities.txt"), __FILE__)
10
+ File.read(path).split("\n").compact.map(&:capitalize)
11
+ end
12
+ end
13
+
14
+ end
@@ -0,0 +1,14 @@
1
+ class FakePerson
2
+
3
+ def favourite_food
4
+ @favourite_food ||= self.class.foods.sample
5
+ end
6
+
7
+ def self.foods
8
+ @foods ||= begin
9
+ path = File.expand_path(File.join('..', '..', '..', 'db', "foods.txt"), __FILE__)
10
+ File.read(path).split("\n").compact.map(&:capitalize)
11
+ end
12
+ end
13
+
14
+ end
@@ -0,0 +1,30 @@
1
+ class FakePerson
2
+
3
+ def likes(count=3)
4
+ @likes ||= begin
5
+ if count == 1
6
+ [favourite_activity]
7
+ elsif count == 2
8
+ [favourite_activity, favourite_food]
9
+ else
10
+ [favourite_activity, favourite_food] + activities_and_foods(count - 2, @dislikes)
11
+ end
12
+ end
13
+ end
14
+
15
+ def dislikes(count=3)
16
+ @dislikes ||= activities_and_foods(count, @likes)
17
+ end
18
+
19
+ private
20
+
21
+ def activities_and_foods(count, exclusion_list=nil)
22
+ exclusion_list ||= []
23
+
24
+ num_activities_to_get = (1..count).to_a.sample
25
+ num_foods_to_get = (count - num_activities_to_get)
26
+
27
+ (self.class.activities - exclusion_list).sample(num_activities_to_get) + (self.class.foods - exclusion_list).sample(num_foods_to_get)
28
+ end
29
+
30
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fake_person
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-16 00:00:00.000000000 Z
11
+ date: 2014-10-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A Ruby library for creating fake personalities
14
14
  email:
@@ -17,13 +17,18 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
+ - db/activities.txt
21
+ - db/foods.txt
20
22
  - db/given_names.female.txt
21
23
  - db/given_names.male.txt
22
24
  - db/surnames.txt
23
25
  - lib/fake_person.rb
26
+ - lib/fake_person/activities.rb
24
27
  - lib/fake_person/date_of_birth.rb
25
28
  - lib/fake_person/email.rb
29
+ - lib/fake_person/foods.rb
26
30
  - lib/fake_person/gender.rb
31
+ - lib/fake_person/likes.rb
27
32
  - lib/fake_person/names.rb
28
33
  - lib/fake_person/titles.rb
29
34
  - lib/fake_person/username.rb