Created
June 26, 2013 13:29
-
-
Save surrealdetective/5867365 to your computer and use it in GitHub Desktop.
secret handshake https://gist.github.com/aviflombaum/74aa528082666c33699d
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
class SecretHandshake | |
attr_accessor :code, :shake | |
def initialize(code) | |
@code = code | |
@shake = [] | |
end | |
def is_wink | |
if code[-1].to_i == 1 | |
@shake << "wink" | |
end | |
end | |
def is_double_blink | |
if code[-2].to_i == 1 | |
@shake << "double blink" | |
end | |
end | |
def is_close_eyes | |
if code[-3].to_i == 1 | |
@shake << "close your eyes" | |
end | |
end | |
def is_jump | |
if code[-4].to_i == 1 | |
@shake << "jump" | |
end | |
end | |
def is_reversed | |
if code[-5].to_i == 1 | |
@shake = @shake.reverse | |
end | |
end | |
def commands | |
is_wink | |
is_double_blink | |
is_close_eyes | |
is_jump | |
is_reversed | |
@shake | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment