Sha256: 076541c040c1c7581c34bfe07b2bf7875390a6815e00a92c3fac64560c61d110
Contents?: true
Size: 711 Bytes
Versions: 188
Compression:
Stored size: 711 Bytes
Contents
struct SecretHandshake { var commandValue: Int var commandValues = [1: "wink", 2: "double blink", 4: "close your eyes", 8: "jump"] init(_ commandValue: Int) { self.commandValue = commandValue } var shouldReverse: Bool { return (commandValue & 16) != 0 } var commands: [String] { return commandsFunc() } private func commandsFunc() -> [String] { var commands = [String]() for key in Array(commandValues.keys).sorted( by: < ) where (commandValue & key) != 0 { commands.append(commandValues[key]!) } if shouldReverse { return Array(commands.reversed()) } else { return commands } } }
Version data entries
188 entries across 188 versions & 1 rubygems