2017-06-21 07:00:19 +02:00
|
|
|
//
|
|
|
|
// ParsedAuthor.swift
|
|
|
|
// RSParser
|
|
|
|
//
|
|
|
|
// Created by Brent Simmons on 6/20/17.
|
|
|
|
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
2017-09-10 20:02:05 +02:00
|
|
|
public struct ParsedAuthor: Hashable {
|
2017-06-21 07:00:19 +02:00
|
|
|
|
|
|
|
public let name: String?
|
|
|
|
public let url: String?
|
|
|
|
public let avatarURL: String?
|
|
|
|
public let emailAddress: String?
|
2017-09-10 20:02:05 +02:00
|
|
|
public let hashValue: Int
|
|
|
|
|
2017-06-25 19:23:30 +02:00
|
|
|
init(name: String?, url: String?, avatarURL: String?, emailAddress: String?) {
|
|
|
|
|
|
|
|
self.name = name
|
|
|
|
self.url = url
|
|
|
|
self.avatarURL = avatarURL
|
|
|
|
self.emailAddress = emailAddress
|
2017-09-10 20:02:05 +02:00
|
|
|
|
|
|
|
var stringToHash = ""
|
|
|
|
stringToHash += name ?? ""
|
|
|
|
stringToHash += url ?? ""
|
|
|
|
stringToHash += avatarURL ?? ""
|
|
|
|
stringToHash += emailAddress ?? ""
|
|
|
|
self.hashValue = stringToHash.hashValue
|
|
|
|
}
|
|
|
|
|
|
|
|
public static func ==(lhs: ParsedAuthor, rhs: ParsedAuthor) -> Bool {
|
|
|
|
|
|
|
|
return lhs.hashValue == rhs.hashValue && lhs.name == rhs.name && lhs.url == rhs.url && lhs.avatarURL == rhs.avatarURL && lhs.emailAddress == rhs.emailAddress
|
2017-06-25 19:23:30 +02:00
|
|
|
}
|
2017-06-21 07:00:19 +02:00
|
|
|
}
|