2017-02-26 16:23:23 +03:00
|
|
|
/**
|
|
|
|
* Tae Won Ha - http://taewon.de - @hataewon
|
|
|
|
* See LICENSE
|
|
|
|
*/
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
2017-04-30 10:25:15 +03:00
|
|
|
class OpenedFileListReducer {
|
2017-02-26 16:23:23 +03:00
|
|
|
|
|
|
|
typealias Pair = StateActionPair<UuidState<MainWindow.State>, OpenedFileList.Action>
|
|
|
|
|
2017-04-30 10:25:15 +03:00
|
|
|
func reduce(_ pair: Pair) -> Pair {
|
|
|
|
var state = pair.state.payload
|
2017-02-26 16:23:23 +03:00
|
|
|
|
2017-04-30 10:25:15 +03:00
|
|
|
switch pair.action {
|
2017-02-26 16:23:23 +03:00
|
|
|
|
2017-04-30 10:25:15 +03:00
|
|
|
case let .open(buffer):
|
2017-06-10 00:16:06 +03:00
|
|
|
state.currentBufferToSet = buffer
|
2017-02-26 16:23:23 +03:00
|
|
|
|
|
|
|
}
|
2017-04-30 10:25:15 +03:00
|
|
|
|
|
|
|
return StateActionPair(state: UuidState(uuid: pair.state.uuid, state: state), action: pair.action)
|
2017-02-26 16:23:23 +03:00
|
|
|
}
|
|
|
|
}
|