CrystalIBAN::Generator
Generates valid IBAN strings for supported countries.
Constructors
new
Creates a generator pre-loaded with the bundled 49-country IBAN structures. This is the standard constructor for shard consumers.
gen = CrystalIBAN::Generator.new
gen.generate(country_code: "LI", bank_code: "08810", account_number: 6_188_284_i64)
# => "LI05088106188284"
new(*, registry : StructureRegistry)
Creates a generator using a shared StructureRegistry. Use this when you also have a Validator to avoid parsing the JSON twice.
new(*, json : String)
Creates a generator from a custom JSON string in the same format as iban_structure.json. Use this to extend or override the default country set.
custom_json = %([{"country":"Testland","country_code":"TS","iban_format":"CCXX BBBB AAAA"}])
gen = CrystalIBAN::Generator.new(json: custom_json)
Class methods
Instance methods
Generates a complete IBAN string for the given country and account details. Raises ArgumentError if the country code is not in the loaded structure file.