Created
May 26, 2016 15:38
-
-
Save lucasprag/7b6ca8104625015461944a4ef4f04c6d to your computer and use it in GitHub Desktop.
key chain with meta-programming
This file contains hidden or 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 KeyChain | |
def initialize(door) | |
@door = door | |
end | |
def get | |
send(door) | |
end | |
private | |
attr_reader :door | |
def bedroom | |
"algorithm of bedroom key" * 3 | |
end | |
def front_door | |
"algorithm of front_door key" * 3 | |
end | |
def bathroom | |
"algorithm of bathroom key" * 3 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment