Skip to content

Commit

Permalink
Update documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
rismay-luassat committed Jun 25, 2024
1 parent 2b07e42 commit 660e900
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
13 changes: 7 additions & 6 deletions Sources/WrkstrmMain/Extensions/ClosedRange+Magnitude.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ extension Range where Bound: BinaryFloatingPoint & Comparable {
/// The magnitude of the range.
///
/// This computed property returns the difference between the upper and lower bounds of the range.
/// It is useful for determining the size or extent of the range when working with floating-point values.
/// It is useful for determining the size or extent of the range when working with floating-point
/// values.
///
/// - Returns: The magnitude of the range as a `Bound` value, representing the distance between
/// `upperBound` and `lowerBound`.
Expand All @@ -16,11 +17,11 @@ extension Range where Bound: BinaryFloatingPoint & Comparable {
extension ClosedRange where Bound: BinaryFloatingPoint & Comparable {
/// The magnitude of the closed range.
///
/// This computed property returns the difference between the upper and lower bounds of the closed range.
/// It is useful for determining the size or extent of the closed range when working with floating-point
/// values.
/// This computed property returns the difference between the upper and lower bounds of the closed
/// range. It is useful for determining the size or extent of the closed range when working with
/// floating-point values.
///
/// - Returns: The magnitude of the closed range as a `Bound` value, representing the distance between
/// `upperBound` and `lowerBound`.
/// - Returns: The magnitude of the closed range as a `Bound` value, representing the distance
/// between `upperBound` and `lowerBound`.
public var magnitude: Bound { upperBound - lowerBound }
}
4 changes: 2 additions & 2 deletions Sources/WrkstrmMain/Extensions/Collection+Sorting.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ extension Collection where Element: Comparable, Index == Int {

/// Performs a binary search for a given key in the collection.
///
/// This method splits the collection into halves to find the key, reducing the search area in each step.
/// It returns the index of the key if found, or `nil` if the key is not present.
/// This method splits the collection into halves to find the key, reducing the search area in
/// each step. It returns the index of the key if found, or `nil` if the key is not present.
///
/// - Parameter key: The element to search for within the collection.
/// - Returns: The index of the element if it's found, otherwise `nil`.
Expand Down
6 changes: 4 additions & 2 deletions Sources/WrkstrmMain/Extensions/CommandLine+Executable.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
extension CommandLine {
/// An array of substrings derived from splitting the first command-line argument by the "/" separator.
/// An array of substrings derived from splitting the first command-line argument by the "/"
/// separator.
/// This representation is useful for extracting the executable name and path.
static let splitArguments: [String.SubSequence] = arguments[0].split(separator: "/")

Expand All @@ -10,7 +11,8 @@ extension CommandLine {
/// It's assumed that the first argument (`arguments[0]`) is the path to the executable.
///
/// - Returns: A `String` representing the name of the executable.
/// - Warning: This property unwraps the last component of `splitArguments` forcibly. If `splitArguments`
/// - Warning: This property unwraps the last component of `splitArguments` forcibly. If
/// `splitArguments`
/// is empty, this will cause a runtime crash.
public static var executableName: String {
String(splitArguments.last!)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
/// Extension of `Optional` to conform to `Comparable` when the wrapped type is `Equatable` and `Comparable`.
/// Extension of `Optional` to conform to `Comparable` when the wrapped type is `Equatable` and
/// `Comparable`.
///
/// This extension allows optional values to be compared using the less-than operator (`<`), provided that
/// the wrapped type conforms to `Equatable` and `Comparable`.
/// This extension allows optional values to be compared using the less-than operator (`<`),
/// provided that the wrapped type conforms to `Equatable` and `Comparable`.
/// Comparison logic is as follows:
/// - If both values are non-nil, their wrapped values are compared.
/// - A nil value is always considered less than a non-nil value.
/// - Two nil values are considered equal (not less than each other).
extension Optional: Comparable where Wrapped: Equatable & Comparable {
/// Compares two optional values using the less-than operator.
///
/// The comparison is based on the wrapped values of the optionals. If both optionals are non-nil, their
/// wrapped values are compared. An optional with a value is always greater than an optional without a
/// value (nil).
/// The comparison is based on the wrapped values of the optionals. If both optionals are non-nil,
/// their wrapped values are compared. An optional with a value is always greater than an
/// optional without a value (nil).
///
/// - Parameters:
/// - lhs: An optional value to compare.
Expand Down

0 comments on commit 660e900

Please sign in to comment.