Skip to content

Commit cfad398

Browse files
committed
Storage.Site: ReadOnlyConvertible Conformance
1 parent 2a8f275 commit cfad398

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import Foundation
2+
import Storage
3+
4+
5+
// Storage.Site: ReadOnlyConvertible Conformance.
6+
//
7+
extension Storage.Site: ReadOnlyConvertible {
8+
9+
/// Updates the Storage.Site with the a ReadOnly.
10+
///
11+
public func update(with site: Yosemite.Site) {
12+
siteID = Int64(site.siteID)
13+
name = site.name
14+
tagline = site.description
15+
url = site.url
16+
isWordPressStore = site.isWordPressStore
17+
}
18+
19+
/// Returns a ReadOnly version of the receiver.
20+
///
21+
public func toReadOnly() -> Yosemite.Site {
22+
return Site(siteID: Int(siteID),
23+
name: name ?? "",
24+
description: tagline ?? "",
25+
url: url ?? "",
26+
isWordPressStore: isWordPressStore)
27+
}
28+
}

0 commit comments

Comments
 (0)