Created
August 14, 2010 14:41
-
-
Save wandernauta/524358 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
import structs/[ArrayList,HashBag] | |
Route: cover { | |
path: String | |
vars: HashBag<String, Cell> | |
} | |
Handler: class { | |
actions: ArrayList<String> | |
routes: ArrayList<Route> | |
init: func(=routes, =actions) | |
getRoute: func(a: String) -> Route { routes[actions indexOf(a)] } | |
getAction: func(r: Route) -> String { actions[routes indexOf(r)] } | |
} | |
r: Route | |
r vars = HashBag<String, Cell> new() | |
r path = "path/to/" | |
r vars add("id", 12) | |
r vars add("q", "aloa") | |
r path println() | |
r vars get("q", String) println() | |
r vars get("id", Int) toString() println() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment