Conditions | 4 |
Total Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | # frozen_string_literal: true |
||
8 | def random_iban(options = {}) |
||
9 | country = options[:country] |
||
10 | searched_tags = options[:tags] |
||
11 | non_searched_tags = options[:not_tags] |
||
12 | |||
13 | unless country |
||
14 | possible_countries = random_generator.keys |
||
15 | possible_countries -= IbanBic.tags.select { |_country, country_tags| (searched_tags - country_tags).any? } .keys if searched_tags.present? |
||
16 | possible_countries -= IbanBic.tags.select { |_country, country_tags| (non_searched_tags & country_tags).any? } .keys if non_searched_tags.present? |
||
17 | country = possible_countries.sample |
||
18 | end |
||
19 | IbanBic.fix(random_generator[country].random_example) |
||
20 | end |
||
21 | |||
36 |