-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from mdiep/create-file
Create file
- Loading branch information
Showing
15 changed files
with
788 additions
and
48 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// Author.swift | ||
// Tentacle | ||
// | ||
// Created by Romain Pouclet on 2016-12-22. | ||
// Copyright © 2016 Matt Diephouse. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Argo | ||
|
||
public struct Author { | ||
/// Name of the Author | ||
let name: String | ||
/// Email of the Author | ||
let email: String | ||
|
||
public init(name: String, email: String) { | ||
self.name = name | ||
self.email = email | ||
} | ||
} | ||
|
||
extension Author: Encodable { | ||
public func encode() -> JSON { | ||
return JSON.object([ | ||
"name": .string(name), | ||
"email": .string(email) | ||
]) | ||
} | ||
} | ||
|
||
extension Author: Hashable, Equatable { | ||
public var hashValue: Int { | ||
return name.hashValue ^ email.hashValue | ||
} | ||
|
||
static public func ==(lhs: Author, rhs: Author) -> Bool { | ||
return lhs.name == rhs.name | ||
&& lhs.email == rhs.email | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.