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:
parent
56ef476f70
commit
23133fe3e8
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user