< Summary

Information
Class: TeleFlow.Annotations.TextRegexAttribute
Assembly: TeleFlow.Annotations
File(s): /_/src/TeleFlow.Annotations/Routing/TextRegexAttribute.cs
Line coverage
100%
Covered lines: 3
Uncovered lines: 0
Coverable lines: 3
Total lines: 27
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%

File(s)

/_/src/TeleFlow.Annotations/Routing/TextRegexAttribute.cs

#LineLine coverage
 1namespace TeleFlow.Annotations;
 2/// <summary>
 3/// Routes a Telegram text message by matching it with a regular expression.
 4/// </summary>
 5[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
 6public sealed class TextRegexAttribute : TeleFlowAttribute
 7{
 8    /// <summary>
 9    /// Creates a text regex route.
 10    /// </summary>
 11    /// <param name="pattern">Regular expression pattern applied to the message text.</param>
 2412    public TextRegexAttribute(string pattern)
 13    {
 2414        ArgumentException.ThrowIfNullOrWhiteSpace(pattern);
 15        Pattern = pattern;
 2416    }
 17
 18    /// <summary>
 19    /// Regular expression pattern applied to the message text.
 20    /// </summary>
 21    public string Pattern { get; }
 22
 23    /// <summary>
 24    /// Matches the message text without case sensitivity.
 25    /// </summary>
 26    public bool IgnoreCase { get; set; } = true;
 27}

Methods/Properties

.ctor(System.String)