0001    public class MemoryModel
MemoryModel.swift:3
    static var all = [MemoryModel]() 
MemoryModel.swift:45
    public static func find(id: String?) -> MemoryModel? {
MemoryModel.swift:51
    public static func destroy(model: MemoryModel?) {
: HTMLRenderable, JSONRenderable { 0002 static var id
MemoryModel.swift:16
        self.attributes["id"] = self.dynamicType.id
MemoryModel.swift:17
        self.dynamicType.id += 1
= 0 0003 static var all
MemoryModel.swift:41
        all.append(new)
MemoryModel.swift:48
        return all.filter{ $0.id == intID }.first 
MemoryModel.swift:53
            all = all.filter({ $0.id != m.id })
MemoryModel.swift:53
            all = all.filter({ $0.id != m.id })
MemoryModel.swift:59
        for model in all {
= [MemoryModel]() 0004 var attributes
MemoryModel.swift:7
            return attributes["id"] as! Int
MemoryModel.swift:10
            attributes["id"] = newID
MemoryModel.swift:15
        self.attributes = attributes 
MemoryModel.swift:16
        self.attributes["id"] = self.dynamicType.id
MemoryModel.swift:22
            return attributes[name]
MemoryModel.swift:25
            attributes[name] = newValue
MemoryModel.swift:60
            var attrs = model.attributes 
MemoryModel.swift:78
        self.attributes = attrs
MemoryModel.swift:82
        return self.attributes  
MemoryModel.swift:86
        return self.attributes  
= [String: Any]() 0005 public var id
MemoryModel.swift:48
        return all.filter{ $0.id == intID }.first 
MemoryModel.swift:53
            all = all.filter({ $0.id != m.id })
MemoryModel.swift:53
            all = all.filter({ $0.id != m.id })
MemoryModel.swift:61
            attrs["id"] = String(model.id)
:Int { 0006 get { 0007 return attributes["id"] as! Int 0008 } 0009 set(newID) { 0010 attributes["id"] = newID 0011 } 0012 } 0013 0014 required public init
MemoryModel.swift:40
        let new = self.init(attrs)
(_ attributes: [String: Any]) { 0015 self.attributes = attributes 0016 self.attributes["id"] = self.dynamicType.id 0017 self.dynamicType.id += 1 0018 } 0019 0020 subscript(name: String) -> Any? { 0021 get { 0022 return attributes[name] 0023 } 0024 set(newValue) { 0025 attributes[name] = newValue 0026 } 0027 } 0028 0029 public static func create(attributes: [String: String]) -> Self { 0030 var attrs = [String: Any]() 0031 for (key, value) in attributes { 0032 if let integer:Int = Int(value) { 0033 attrs[key] = integer 0034 } else if let double:Double = Double(value) { 0035 attrs[key] = double 0036 } else { 0037 attrs[key] = value 0038 } 0039 } 0040 let new = self.init(attrs) 0041 all.append(new) 0042 return new 0043 } 0044 0045 public static func find(id: String?) -> MemoryModel? { 0046 guard let stringID = id else { return nil } 0047 guard let intID = Int(stringID) else { return nil } 0048 return all.filter{ $0.id == intID }.first 0049 } 0050 0051 public static func destroy(model: MemoryModel?) { 0052 if let m = model { 0053 all = all.filter({ $0.id != m.id }) 0054 } 0055 } 0056 0057 public static func allAttributes() -> Any { 0058 var items = [Any]() 0059 for model in all { 0060 var attrs = model.attributes 0061 attrs["id"] = String(model.id) 0062 items.append(attrs as Any) 0063 } 0064 return items as Any 0065 } 0066 0067 public func update(attributes: [String: String]) { 0068 var attrs = [String: Any]() 0069 for (key, value) in attributes { 0070 if let integer:Int = Int(value) { 0071 attrs[key] = integer 0072 } else if let double:Double = Double(value) { 0073 attrs[key] = double 0074 } else { 0075 attrs[key] = value 0076 } 0077 } 0078 self.attributes = attrs 0079 } 0080 0081 public func renderableAttributes() -> [String: Any] { 0082 return self.attributes 0083 } 0084 0085 public func renderableJSONAttributes() -> [String: Any] { 0086 return self.attributes 0087 } 0088 } 0089 0090