Created
June 6, 2015 14:43
-
-
Save towry/b43e2ac3d71baaa9e66d 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
#!/usr/bin/env ruby | |
# -*- encoding: UTF-8 -*- | |
class Base | |
attr_reader :blocks | |
class << self | |
def get(path, &block) | |
@blocks ||= [] | |
@blocks << block | |
end | |
def reset! | |
@blocks = [] | |
end | |
def run | |
@blocks.each do |bk| | |
bk.call | |
end | |
end | |
end | |
def self.inherited(subclass) | |
subclass.reset! | |
end | |
reset! | |
end | |
class Application < Base | |
get '/' do | |
puts "hi" | |
end | |
end | |
if __FILE__ == $0 | |
Application.run | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment