Created
July 11, 2016 13:51
-
-
Save sdogruyol/1c74dbe69d6bbfd21c60ab15e92230d9 to your computer and use it in GitHub Desktop.
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
# Context is the environment which holds request/response specific | |
# information such as params, content_type e.g | |
class HTTP::Server | |
class Context | |
STORE = {} of String => Box | |
def set(key, value) | |
STORE[key] = {"object": Box.box(value), "type": typeof(value)} | |
end | |
def get(key) | |
object = STORE[key] | |
box(object["type"]).unbox(object["object"]) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment