Class: Feet::Application
Instance Method Summary collapse
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/feet.rb', line 14 def call(env) return [404, { 'Content-Type' => 'text/html' }, []] if env['PATH_INFO'] == '/favicon.ico' # Assign a default Feet HTML welcome page (in public/index.html) if env['PATH_INFO'] == '/feet' path = File.('../public/index.html', __dir__) return [200, { 'Content-Type' => 'text/html' }, File.open(path)] end rack_app = get_rack_app(env) rack_app.call(env) end |
#get_rack_app(env) ⇒ Object
135 136 137 138 139 |
# File 'lib/feet/routing.rb', line 135 def get_rack_app(env) raise 'No routes!' unless @route_obj @route_obj.check_url env['PATH_INFO'], env['REQUEST_METHOD'] end |
#route(&block) ⇒ Object
130 131 132 133 |
# File 'lib/feet/routing.rb', line 130 def route(&block) @route_obj ||= RouteObject.new @route_obj.instance_eval(&block) end |