Skip to content

Instantly share code, notes, and snippets.

@sushant12
Created June 3, 2017 06:02
Show Gist options
  • Save sushant12/52c1a717d63b020645e0647c5030864f to your computer and use it in GitHub Desktop.
Save sushant12/52c1a717d63b020645e0647c5030864f to your computer and use it in GitHub Desktop.
module Todo
class Application
class << self
attr_accessor :env
def call(env)
self.env = env
Rack::Response.new( *dispatch)
# if(env['PATH_INFO'] == '/')
# Rack::Response.new(TasksController.new.index)
# end
end
def dispatch
controller.new(env).public_send(env['action'])
end
def controller
Object.const_get(env[ 'controller' ].capitalize + 'Controller' )
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment