faker-gpk 0.1.1 → 0.1.2
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 +4 -4
- data/README.md +15 -0
- data/lib/faker/gpk/version.rb +1 -1
- data/lib/faker/locales/en/garbage_pail_kids.yml +2719 -1419
- data/lib/faker/trading_cards/garbage_pail_kids.rb +39 -11
- metadata +3 -6
|
@@ -4,17 +4,45 @@ module Faker
|
|
|
4
4
|
class TradingCards
|
|
5
5
|
class GarbagePailKids < Base
|
|
6
6
|
class << self
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
def series
|
|
8
|
+
translate("faker.garbage_pail_kids.series")
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def cards(from: 'ALL')
|
|
12
|
+
from == 'ALL' ? series.flat_map { _1[:cards] } : find_series(from)[:cards]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def name(from: "ALL")
|
|
16
|
+
draw_unique(:names, from) { cards(from: from).map { _1[:name] }.uniq }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def number(from: "ALL")
|
|
20
|
+
draw_unique(:ids, from) { cards(from: from).map { _1[:id] }.uniq }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def card(from: "ALL")
|
|
24
|
+
draw_unique(:cards, from) { cards(from: from).uniq { [_1[:id], _1[:name]] } }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def reset_unique!(from: nil)
|
|
28
|
+
return @unique_bags = nil unless from
|
|
29
|
+
|
|
30
|
+
unique_bags.each_value { _1.delete(from) }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
private
|
|
34
|
+
|
|
35
|
+
def draw_unique(kind, from)
|
|
36
|
+
unique_bags[kind][from] = shuffle(yield) if unique_bags[kind][from].nil? || unique_bags[kind][from].empty?
|
|
37
|
+
unique_bags[kind][from].pop
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def unique_bags
|
|
41
|
+
@unique_bags ||= Hash.new { |bags, kind| bags[kind] = {} }
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def find_series(id)
|
|
45
|
+
series.find { _1[:id] == id }
|
|
18
46
|
end
|
|
19
47
|
end
|
|
20
48
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: faker-gpk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rob Lacey
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: faker
|
|
@@ -50,7 +49,6 @@ metadata:
|
|
|
50
49
|
homepage_uri: https://github.com/braindeaf/faker-gpk
|
|
51
50
|
source_code_uri: https://github.com/braindeaf/faker-gpk
|
|
52
51
|
changelog_uri: https://github.com/braindeaf/faker-gpk/CHANGELOG.md
|
|
53
|
-
post_install_message:
|
|
54
52
|
rdoc_options: []
|
|
55
53
|
require_paths:
|
|
56
54
|
- lib
|
|
@@ -65,8 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
65
63
|
- !ruby/object:Gem::Version
|
|
66
64
|
version: '0'
|
|
67
65
|
requirements: []
|
|
68
|
-
rubygems_version:
|
|
69
|
-
signing_key:
|
|
66
|
+
rubygems_version: 4.0.3
|
|
70
67
|
specification_version: 4
|
|
71
68
|
summary: Faker extension for Garbage Pail Kids
|
|
72
69
|
test_files: []
|