Skip to content

Instantly share code, notes, and snippets.

@sdogruyol
Created July 11, 2016 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sdogruyol/1c74dbe69d6bbfd21c60ab15e92230d9 to your computer and use it in GitHub Desktop.
Save sdogruyol/1c74dbe69d6bbfd21c60ab15e92230d9 to your computer and use it in GitHub Desktop.
# 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