1
1
mirror of https://github.com/github/semantic.git synced 2024-11-29 02:44:36 +03:00

JSONLeaf is CustomJSONConvertible.

This commit is contained in:
Rob Rix 2015-10-09 09:14:07 -05:00
parent 56ef476f70
commit 23133fe3e8

View File

@ -1,13 +1,29 @@
import Doubt
import Cocoa
enum JSONLeaf: Equatable, CustomStringConvertible {
enum JSONLeaf: Equatable, CustomJSONConvertible, CustomStringConvertible {
case Number(Double)
case Boolean(Bool)
case String(Swift.String)
case Null
// MARK: CustomJSONConvertible
var JSON: Doubt.JSON {
switch self {
case let .Number(n):
return .Number(n)
case let .Boolean(b):
return .Boolean(b)
case let .String(s):
return .String(s)
case .Null:
return .Null
}
}
// MARK: CustomStringConvertible
var description: Swift.String {