Skip to content

Commit

Permalink
Merge pull request #46 from vapor/path-clarifications
Browse files Browse the repository at this point in the history
Path clarifications
  • Loading branch information
loganwright authored Feb 23, 2017
2 parents 18ba5ae + 60c0f34 commit c94e556
Show file tree
Hide file tree
Showing 22 changed files with 617 additions and 535 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/**/*/*.DS_Store
# Xcode
#
build/
Expand Down
11 changes: 6 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import PackageDescription

let alpha = Version(2, 0, 0, prereleaseIdentifiers: ["alpha"])

let package = Package(
name: "Node",
targets: [
Target(
name: "Node"
),
Target(name: "Node"),
],
dependencies: [
.Package(url: "https://github.com/vapor/path-indexable.git", majorVersion: 1),
.Package(url: "https://github.com/vapor/polymorphic.git", Version(2, 0, 0, prereleaseIdentifiers: ["alpha.1"]))
.Package(url: "https://github.com/vapor/path-indexable.git", alpha),
.Package(url: "https://github.com/vapor/polymorphic.git", alpha),
.Package(url: "https://github.com/vapor/bits.git", majorVersion: 0)
]
)
2 changes: 1 addition & 1 deletion Sources/Node/Convertible/Bool+Convertible.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ extension Bool: NodeConvertible {

public init(node: Node, in context: Context) throws {
guard let bool = node.bool else {
throw NodeError(node: node, expectation: "\(Bool.self)", key: nil)
throw NodeError(node: node, expectation: "\(Bool.self)")
}
self = bool
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Node/Convertible/Date+Convertible.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ extension Date: NodeConvertible {
else { fallthrough }
self = date
default:
throw NodeError(node: node, expectation: "\(Date.self), formatted time string, or timestamp", key: nil)
throw NodeError(node: node, expectation: "\(Date.self), formatted time string, or timestamp")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Node/Convertible/FloatingPoint+Convertible.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ extension NodeConvertibleFloatingPointType {

public init(node: Node, in context: Context) throws {
guard let double = node.double else {
throw NodeError(node: node, expectation: "\(Self.self)", key: nil)
throw NodeError(node: node, expectation: "\(Self.self)")
}
self.init(double)
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Node/Convertible/Integer+Convertible.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension SignedInteger {

public init(node: Node, in context: Context) throws {
guard let int = node.int else {
throw NodeError(node: node, expectation: "\(Self.self)", key: nil)
throw NodeError(node: node, expectation: "\(Self.self)")
}

self.init(int.toIntMax())
Expand Down
2 changes: 1 addition & 1 deletion Sources/Node/Convertible/Sequence+Convertible.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ extension KeyAccessible where Key == String, Value: NodeInitializable {
public init(node: NodeRepresentable, in context: Context = EmptyNode) throws {
let node = try node.makeNode(context: context)
guard let object = node.nodeObject else {
throw NodeError(node: node, expectation: "\([Key: Value].self)", key: nil)
throw NodeError(node: node, expectation: "\([Key: Value].self)")
}

var mapped: [String: Value] = [:]
Expand Down
2 changes: 1 addition & 1 deletion Sources/Node/Convertible/String+Convertible.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ extension String: NodeConvertible {

public init(node: Node, in context: Context) throws {
guard let string = node.string else {
throw NodeError(node: node, expectation: "\(String.self)", key: nil)
throw NodeError(node: node, expectation: "\(String.self)")
}
self = string
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Node/Convertible/UUID+Convertible.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Foundation
extension UUID: NodeConvertible {
public init(node: Node, in context: Context) throws {
guard let string = node.string, let uuid = UUID(uuidString: string) else {
throw NodeError(node: node, expectation: "\(UUID.self)", key: nil)
throw NodeError(node: node, expectation: "\(UUID.self)")
}
self = uuid
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Node/Convertible/UnsignedInteger+Convertible.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension UnsignedInteger {

public init(node: Node, in context: Context) throws {
guard let int = node.uint else {
throw NodeError(node: node, expectation: "\(Self.self)", key: nil)
throw NodeError(node: node, expectation: "\(Self.self)")
}

self.init(int.toUIntMax())
Expand Down
4 changes: 4 additions & 0 deletions Sources/Node/Core/Node+Polymorphic.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Bits

extension Node: Polymorphic {
public var string: String? {
switch self {
Expand All @@ -9,6 +11,8 @@ extension Node: Polymorphic {
return string
case .date(let date):
return Date.outgoingDateFormatter.string(from: date)
case .bytes(let bytes):
return bytes.string
default:
return nil
}
Expand Down
6 changes: 6 additions & 0 deletions Sources/Node/Core/Node.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ public enum Node {
case date(Date)
}

extension Node {
public init() {
self.init([:])
}
}

extension Node: CustomStringConvertible {
public var description: String {
switch self {
Expand Down
251 changes: 0 additions & 251 deletions Sources/Node/Extract/Node+Extract.swift

This file was deleted.

Loading

0 comments on commit c94e556

Please sign in to comment.