Skip to content

Instantly share code, notes, and snippets.

@tcrayford
Created April 5, 2012 20:53
Show Gist options
  • Save tcrayford/2314103 to your computer and use it in GitHub Desktop.
Save tcrayford/2314103 to your computer and use it in GitHub Desktop.
# with dependency injection, and slightly different route syntax:
module WebCrawler
Routes = Raptor::App.new(self) do
queue = #... some sort of persistent queue initialized here
crawler = WebCrawler.new(queue)
path "to-be-crawled" do
create crawler, :enqueue!, :require => :logged_in
end
end
end
# Downsides:
# routes creation methods are going to have to is_a? check their args
# so people can still use the default delegate actions
@tcrayford
Copy link
Author

Another plus: this gets rid of the nastiness with :to stuff described as strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment