Skip to content

Commit e96ed76

Browse files
sgleadowkzaher
authored andcommitted
Internal materialize method rename to better capture what it does
1 parent 0a7a960 commit e96ed76

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

RxBlocking/BlockingObservable+Operators.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extension BlockingObservable {
2222
///
2323
/// - returns: All elements of sequence.
2424
public func toArray() throws -> [E] {
25-
let results = convertToArray()
25+
let results = materializeResult()
2626
return try elementsOrThrow(results)
2727
}
2828
}
@@ -34,7 +34,7 @@ extension BlockingObservable {
3434
///
3535
/// - returns: First element of sequence. If sequence is empty `nil` is returned.
3636
public func first() throws -> E? {
37-
let results = convertToArray(max: 1)
37+
let results = materializeResult(max: 1)
3838
return try elementsOrThrow(results).first
3939
}
4040
}
@@ -46,7 +46,7 @@ extension BlockingObservable {
4646
///
4747
/// - returns: Last element in the sequence. If sequence is empty `nil` is returned.
4848
public func last() throws -> E? {
49-
let results = convertToArray()
49+
let results = materializeResult()
5050
return try elementsOrThrow(results).last
5151
}
5252
}
@@ -68,7 +68,7 @@ extension BlockingObservable {
6868
/// - parameter predicate: A function to test each source element for a condition.
6969
/// - returns: Returns the only element of an sequence that satisfies the condition in the predicate, and reports an error if there is not exactly one element in the sequence.
7070
public func single(_ predicate: @escaping (E) throws -> Bool) throws -> E? {
71-
let results = convertToArray(max: 2, predicate: predicate)
71+
let results = materializeResult(max: 2, predicate: predicate)
7272
let elements = try elementsOrThrow(results)
7373

7474
switch elements.count {
@@ -89,12 +89,12 @@ extension BlockingObservable {
8989
///
9090
/// - returns: On completion, returns the list of elements in the sequence. On error, returns the list of elements up to that point, along with the error itself.
9191
public func materialize() -> SequenceMaterializeResult<E> {
92-
return convertToArray()
92+
return materializeResult()
9393
}
9494
}
9595

9696
extension BlockingObservable {
97-
fileprivate func convertToArray(max: Int? = nil, predicate: @escaping (E) throws -> Bool = { _ in true }) -> SequenceMaterializeResult<E> {
97+
fileprivate func materializeResult(max: Int? = nil, predicate: @escaping (E) throws -> Bool = { _ in true }) -> SequenceMaterializeResult<E> {
9898
var elements: [E] = Array<E>()
9999
var error: Swift.Error?
100100

0 commit comments

Comments
 (0)