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