diff --git a/src/Humanizer/Bytes/ByteSize.cs b/src/Humanizer/Bytes/ByteSize.cs index e09d9783b..253f749d5 100644 --- a/src/Humanizer/Bytes/ByteSize.cs +++ b/src/Humanizer/Bytes/ByteSize.cs @@ -27,6 +27,7 @@ namespace Humanizer.Bytes /// /// Represents a byte size value. /// +#pragma warning disable 1591 public struct ByteSize : IComparable, IEquatable { public static readonly ByteSize MinValue = FromBits(long.MinValue); @@ -384,3 +385,4 @@ public static ByteSize Parse(string s) } } } +#pragma warning restore 1591 diff --git a/src/Humanizer/EnumHumanizeExtensions.cs b/src/Humanizer/EnumHumanizeExtensions.cs index 4fd2327ce..b4891c463 100644 --- a/src/Humanizer/EnumHumanizeExtensions.cs +++ b/src/Humanizer/EnumHumanizeExtensions.cs @@ -4,6 +4,9 @@ namespace Humanizer { + /// + /// Contains extension methods for humanizing Enums + /// public static class EnumHumanizeExtensions { private static readonly Func DescriptionProperty = p => p.Name == "Description" && p.PropertyType == typeof (string); diff --git a/src/Humanizer/Humanizer.csproj b/src/Humanizer/Humanizer.csproj index 48a21ac9b..a9ad7e493 100644 --- a/src/Humanizer/Humanizer.csproj +++ b/src/Humanizer/Humanizer.csproj @@ -27,7 +27,7 @@ prompt 4 bin\Debug\Humanizer.xml - 1591 + true pdbonly @@ -37,7 +37,7 @@ prompt 4 bin\Release\Humanizer.xml - 1591 + true bin\Release\ @@ -204,4 +204,4 @@ --> - \ No newline at end of file + diff --git a/src/Humanizer/Localisation/Formatters/DefaultFormatter.cs b/src/Humanizer/Localisation/Formatters/DefaultFormatter.cs index 727c157d4..37eca6839 100644 --- a/src/Humanizer/Localisation/Formatters/DefaultFormatter.cs +++ b/src/Humanizer/Localisation/Formatters/DefaultFormatter.cs @@ -6,28 +6,41 @@ public class DefaultFormatter : IFormatter { /// - /// Now! + /// Now /// - /// Time expressed in words + /// Returns Now public virtual string DateHumanize_Now() { return GetResourceForDate(TimeUnit.Millisecond, Tense.Past, 0); } + /// + /// Returns the string representation of the provided DateTime + /// + /// + /// + /// + /// public virtual string DateHumanize(TimeUnit timeUnit, Tense timeUnitTense, int unit) { return GetResourceForDate(timeUnit, timeUnitTense, unit); } /// - /// In NO time! + /// 0 seconds /// - /// Time expressed in words + /// Returns 0 seconds as the string representation of Zero TimeSpan public virtual string TimeSpanHumanize_Zero() { return GetResourceForTimeSpan(TimeUnit.Millisecond, 0); } + /// + /// Returns the string representation of the provided TimeSpan + /// + /// + /// + /// public virtual string TimeSpanHumanize(TimeUnit timeUnit, int unit) { return GetResourceForTimeSpan(timeUnit, unit); @@ -45,21 +58,43 @@ private string GetResourceForTimeSpan(TimeUnit unit, int count) return count == 1 ? Format(resourceKey) : Format(resourceKey, count); } + /// + /// + /// + /// + /// protected virtual string Format(string resourceKey) { return Resources.GetResource(GetResourceKey(resourceKey)); } + /// + /// + /// + /// + /// + /// protected virtual string Format(string resourceKey, int number) { return Resources.GetResource(GetResourceKey(resourceKey, number)).FormatWith(number); } + /// + /// Override this method if your locale has complex rules around multiple units; e.g. Arabic, Russian + /// + /// The resource key that's being in formatting + /// The number of the units being used in formatting + /// protected virtual string GetResourceKey(string resourceKey, int number) { return resourceKey; } + /// + /// + /// + /// + /// protected virtual string GetResourceKey(string resourceKey) { return resourceKey; diff --git a/src/Humanizer/Localisation/Formatters/IFormatter.cs b/src/Humanizer/Localisation/Formatters/IFormatter.cs index b591d6cfa..887209658 100644 --- a/src/Humanizer/Localisation/Formatters/IFormatter.cs +++ b/src/Humanizer/Localisation/Formatters/IFormatter.cs @@ -7,10 +7,33 @@ /// public interface IFormatter { + /// + /// Now + /// + /// Returns Now string DateHumanize_Now(); + + /// + /// Returns the string representation of the provided DateTime + /// + /// + /// + /// + /// string DateHumanize(TimeUnit timeUnit, Tense timeUnitTense, int unit); - + + /// + /// 0 seconds + /// + /// Returns 0 seconds as the string representation of Zero TimeSpan string TimeSpanHumanize_Zero(); + + /// + /// Returns the string representation of the provided TimeSpan + /// + /// + /// + /// string TimeSpanHumanize(TimeUnit timeUnit, int unit); } } diff --git a/src/Humanizer/Localisation/ResourceKeys.Common.cs b/src/Humanizer/Localisation/ResourceKeys.Common.cs index 1774b1052..5f995cb6d 100644 --- a/src/Humanizer/Localisation/ResourceKeys.Common.cs +++ b/src/Humanizer/Localisation/ResourceKeys.Common.cs @@ -2,6 +2,9 @@ namespace Humanizer.Localisation { + /// + /// + /// public partial class ResourceKeys { private const string Single = "Single"; diff --git a/src/Humanizer/Localisation/ResourceKeys.DateHumanize.cs b/src/Humanizer/Localisation/ResourceKeys.DateHumanize.cs index 3c49856fd..ee91374f9 100644 --- a/src/Humanizer/Localisation/ResourceKeys.DateHumanize.cs +++ b/src/Humanizer/Localisation/ResourceKeys.DateHumanize.cs @@ -2,6 +2,9 @@ { public partial class ResourceKeys { + /// + /// Encapsulates the logic required to get the resource keys for DateTime.Humanize + /// public static class DateHumanize { /// diff --git a/src/Humanizer/Localisation/ResourceKeys.TimeSpanHumanize.cs b/src/Humanizer/Localisation/ResourceKeys.TimeSpanHumanize.cs index 85ef1d74a..321e961a3 100644 --- a/src/Humanizer/Localisation/ResourceKeys.TimeSpanHumanize.cs +++ b/src/Humanizer/Localisation/ResourceKeys.TimeSpanHumanize.cs @@ -2,6 +2,9 @@ { public partial class ResourceKeys { + /// + /// Encapsulates the logic required to get the resource keys for TimeSpan.Humanize + /// public static class TimeSpanHumanize { /// diff --git a/src/Humanizer/Localisation/TimeUnit.cs b/src/Humanizer/Localisation/TimeUnit.cs index 86c4a56b4..e8941b3c1 100644 --- a/src/Humanizer/Localisation/TimeUnit.cs +++ b/src/Humanizer/Localisation/TimeUnit.cs @@ -3,6 +3,7 @@ /// /// Units of time. /// +#pragma warning disable 1591 public enum TimeUnit { Millisecond, @@ -14,4 +15,5 @@ public enum TimeUnit Month, Year } +#pragma warning restore 1591 } \ No newline at end of file diff --git a/src/Humanizer/NoMatchFoundException.cs b/src/Humanizer/NoMatchFoundException.cs index 19dafef78..30614308a 100644 --- a/src/Humanizer/NoMatchFoundException.cs +++ b/src/Humanizer/NoMatchFoundException.cs @@ -5,6 +5,7 @@ namespace Humanizer /// /// This is thrown on String.DehumanizeTo enum when the provided string cannot be mapped to the target enum /// +#pragma warning disable 1591 public class NoMatchFoundException : Exception { public NoMatchFoundException() @@ -21,4 +22,5 @@ public NoMatchFoundException(string message, Exception inner) { } } +#pragma warning restore 1591 } \ No newline at end of file diff --git a/src/Humanizer/RomanNumeralExtensions.cs b/src/Humanizer/RomanNumeralExtensions.cs index a37c85a45..d6e72b772 100644 --- a/src/Humanizer/RomanNumeralExtensions.cs +++ b/src/Humanizer/RomanNumeralExtensions.cs @@ -6,6 +6,9 @@ namespace Humanizer { + /// + /// Contains extension methods for changing a number to Roman representation (ToRoman) and from Roman representation back to the number (FromRoman) + /// public static class RomanNumeralExtensions { private const int NumberOfRomanNumeralMaps = 13; diff --git a/src/Humanizer/Transformer/To.cs b/src/Humanizer/Transformer/To.cs index fb0cef5cd..ad24f88f6 100644 --- a/src/Humanizer/Transformer/To.cs +++ b/src/Humanizer/Transformer/To.cs @@ -18,6 +18,12 @@ public static string Transform(this string input, params IStringTransformer[] tr return transformers.Aggregate(input, (current, stringTransformer) => stringTransformer.Transform(current)); } + /// + /// Changes string to title case + /// + /// + /// "INvalid caSEs arE corrected" -> "Invalid Cases Are Corrected" + /// public static IStringTransformer TitleCase { get @@ -26,6 +32,12 @@ public static IStringTransformer TitleCase } } + /// + /// Changes the string to lower case + /// + /// + /// "Sentence casing" -> "sentence casing" + /// public static IStringTransformer LowerCase { get @@ -34,6 +46,12 @@ public static IStringTransformer LowerCase } } + /// + /// Changes the string to upper case + /// + /// + /// "lower case statement" -> "LOWER CASE STATEMENT" + /// public static IStringTransformer UpperCase { get @@ -42,6 +60,12 @@ public static IStringTransformer UpperCase } } + /// + /// Changes the string to sentence case + /// + /// + /// "lower case statement" -> "Lower case statement" + /// public static IStringTransformer SentenceCase { get