Skip to content

Commit

Permalink
chore: make SwiftPattern fully internal, instead of public in DEBUG. …
Browse files Browse the repository at this point in the history
…Instead expose the parsed pattern via the import record/DTO. (#213)
  • Loading branch information
skwasjer authored Oct 3, 2024
1 parent d08a484 commit 274bb4b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/IbanNet.CodeGen/IbanNet.CodeGen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@
<PackageReference Include="CsvHelper" Version="30.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\IbanNet\IbanNet.csproj" />
</ItemGroup>

</Project>
4 changes: 4 additions & 0 deletions src/IbanNet.CodeGen/Swift/SwiftCsvRecord.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.Globalization;
using CsvHelper.Configuration.Attributes;
using IbanNet.CodeGen.Swift.Converters;
using IbanNet.Registry.Patterns;
using IbanNet.Registry.Swift;

namespace IbanNet.CodeGen.Swift;

Expand Down Expand Up @@ -78,6 +80,8 @@ public record IbanCsvData
[Name("IBAN structure")]
public string Pattern { get; set; } = default!;

public Pattern SwiftPattern => new SwiftPattern(Pattern);

[Name("IBAN length")]
public int Length { get; set; }

Expand Down
3 changes: 3 additions & 0 deletions src/IbanNet/Properties/AssemblyInfoAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@

[assembly: InternalsVisibleTo("IbanNet.Tests")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
#if DEBUG
[assembly: InternalsVisibleTo("IbanNet.CodeGen")]
#endif
[assembly: NeutralResourcesLanguage("en")]
[assembly: CLSCompliant(true)]
7 changes: 1 addition & 6 deletions src/IbanNet/Registry/Swift/SwiftPattern.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
namespace IbanNet.Registry.Swift;

/// <inheritdoc />
#if DEBUG
public
#else
internal
#endif
class SwiftPattern : Pattern
internal class SwiftPattern : Pattern
{
private static readonly SwiftPatternTokenizer Tokenizer = new();
private string? _pattern;
Expand Down
2 changes: 1 addition & 1 deletion src/IbanNet/Registry/Swift/SwiftRegistryProvider.tt
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public class SwiftRegistryProvider : IIbanRegistryProvider
<#
foreach (var record in records)
{
var pattern = new SwiftPattern(record.Iban.Pattern);
var pattern = record.Iban.SwiftPattern;
#>

[GeneratedCode("SwiftRegistryProviderT4", "1.1-<#= registryReleaseVersion #>")]
Expand Down

0 comments on commit 274bb4b

Please sign in to comment.