namespace StellaOps.Scanner.Analyzers.Lang.Ruby.Internal; internal sealed class RubyLockData { private RubyLockData(IReadOnlyList entries, string bundledWith) { Entries = entries; BundledWith = bundledWith ?? string.Empty; } public IReadOnlyList Entries { get; } public string BundledWith { get; } public bool IsEmpty => Entries.Count == 0; public static ValueTask LoadAsync(LanguageAnalyzerContext context, CancellationToken cancellationToken) { ArgumentNullException.ThrowIfNull(context); return RubyLockCollector.LoadAsync(context, cancellationToken); } public static RubyLockData Create(IReadOnlyList entries, string bundledWith) { if (entries.Count == 0 && string.IsNullOrWhiteSpace(bundledWith)) { return Empty; } return new RubyLockData(entries, bundledWith); } public static RubyLockData Empty { get; } = new(Array.Empty(), string.Empty); }