Class: Faker::TradingCards::GarbagePailKids

Inherits:
Base
  • Object
show all
Defined in:
lib/faker/trading_cards/garbage_pail_kids.rb

Class Method Summary collapse

Class Method Details

.card(from: "ALL") ⇒ Object



23
24
25
# File 'lib/faker/trading_cards/garbage_pail_kids.rb', line 23

def card(from: "ALL")
  draw_unique(:cards, from) { cards(from: from).uniq { [_1[:id], _1[:name]] } }
end

.cards(from: 'ALL') ⇒ Object



11
12
13
# File 'lib/faker/trading_cards/garbage_pail_kids.rb', line 11

def cards(from: 'ALL')
  from == 'ALL' ? series.flat_map { _1[:cards] } : find_series(from)[:cards]
end

.name(from: "ALL") ⇒ Object



15
16
17
# File 'lib/faker/trading_cards/garbage_pail_kids.rb', line 15

def name(from: "ALL")
  draw_unique(:names, from) { cards(from: from).map { _1[:name] }.uniq }
end

.number(from: "ALL") ⇒ Object



19
20
21
# File 'lib/faker/trading_cards/garbage_pail_kids.rb', line 19

def number(from: "ALL")
  draw_unique(:ids, from) { cards(from: from).map { _1[:id] }.uniq }
end

.reset_unique!(from: nil) ⇒ Object



27
28
29
30
31
# File 'lib/faker/trading_cards/garbage_pail_kids.rb', line 27

def reset_unique!(from: nil)
  return @unique_bags = nil unless from

  unique_bags.each_value { _1.delete(from) }
end

.seriesObject



7
8
9
# File 'lib/faker/trading_cards/garbage_pail_kids.rb', line 7

def series
  translate("faker.garbage_pail_kids.series")
end