Skip to content

Commit 4c456aa

Browse files
fix: scaladoc description
As mentioned in #27.
1 parent e13bcc2 commit 4c456aa

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

core/src/main/scala/ox/channels/SourceOps.scala

+9-9
Original file line numberDiff line numberDiff line change
@@ -514,13 +514,13 @@ trait SourceOps[+T] { this: Source[T] =>
514514
}
515515
c
516516

517-
/** Returns the first element from this source wrapped in [[Some]] or [[None]] when the source is empty. Note that `headOption` is not an
517+
/** Returns the first element from this source wrapped in [[Some]] or [[None]] when this source is empty. Note that `headOption` is not an
518518
* idempotent operation on source as it receives elements from it.
519519
*
520520
* @return
521521
* A `Some(first element)` if source is not empty or `None` otherwise.
522522
* @throws ChannelClosedException.Error
523-
* When [[receive]] fails.
523+
* When receiving an element from this source fails.
524524
* @example
525525
* {{{
526526
* import ox.*
@@ -542,30 +542,30 @@ trait SourceOps[+T] { this: Source[T] =>
542542
case t: T @unchecked => Some(t)
543543
}
544544

545-
/** Returns the first element from this source or throws [[NoSuchElementException]] when the source is empty. In case when the [[receive]]
546-
* operation fails with exception then [[ChannelClosedException.Error]] is thrown. Note that `head` is not an idempotent operation on
545+
/** Returns the first element from this source or throws [[NoSuchElementException]] when this source is empty. In case when receiving an
546+
* element fails with exception then [[ChannelClosedException.Error]] is thrown. Note that `head` is not an idempotent operation on
547547
* source as it receives elements from it.
548548
*
549549
* @return
550550
* A first element if source is not empty or throws otherwise.
551551
* @throws NoSuchElementException
552-
* When a source is empty.
552+
* When this source is empty.
553553
* @throws ChannelClosedException.Error
554-
* When [[receive]] fails.
554+
* When receiving an element from this source fails.
555555
* @example
556556
* {{{
557557
* import ox.*
558558
* import ox.channels.Source
559559
*
560560
* supervised {
561-
* Source.empty[Int].head() // throws NoSuchElementException("cannot obtain head from an empty source")
561+
* Source.empty[Int].head() // throws NoSuchElementException("cannot obtain head element from an empty source")
562562
* val s = Source.fromValues(1, 2)
563563
* s.head() // 1
564564
* s.head() // 2
565565
* }
566566
* }}}
567567
*/
568-
def head(): T = headOption().getOrElse(throw new NoSuchElementException("cannot obtain head from an empty source"))
568+
def head(): T = headOption().getOrElse(throw new NoSuchElementException("cannot obtain head element from an empty source"))
569569

570570
/** Sends elements to the returned channel limiting the throughput to specific number of elements (evenly spaced) per time unit. Note that
571571
* the element's `receive()` time is included in the resulting throughput. For instance having `throttle(1, 1.second)` and `receive()`
@@ -646,7 +646,7 @@ trait SourceOps[+T] { this: Source[T] =>
646646
* @return
647647
* A last element if source is not empty or throws otherwise.
648648
* @throws NoSuchElementException
649-
* When source is empty.
649+
* When this source is empty.
650650
* @throws ChannelClosedException.Error
651651
* When receiving an element from this source fails.
652652
* @example

core/src/test/scala/ox/channels/SourceOpsHeadTest.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class SourceOpsHeadTest extends AnyFlatSpec with Matchers {
1010
it should "throw NoSuchElementException for the empty source" in supervised {
1111
the[NoSuchElementException] thrownBy {
1212
Source.empty[Int].head()
13-
} should have message "cannot obtain head from an empty source"
13+
} should have message "cannot obtain head element from an empty source"
1414
}
1515

1616
it should "throw ChannelClosedException.Error with exception and message that was thrown during retrieval" in supervised {

0 commit comments

Comments
 (0)