Skip to content

Instantly share code, notes, and snippets.

@thatdutchguy
Created March 28, 2011 22:03
Show Gist options
  • Save thatdutchguy/891389 to your computer and use it in GitHub Desktop.
Save thatdutchguy/891389 to your computer and use it in GitHub Desktop.
CellRouter
# HACKY, first attempt
class CellRouter
class FakeController
attr_accessor :request, :config
end
class FakeCell < Cell::Rails
def initialize
super(FakeController.new)
end
end
def initialize(name, state)
@name, @state = name, state
end
def call(env)
[200, {"Content-Type" => "text/html"}, [render_cell @name, @state, Rack::Request.new(env).params]]
end
private
def render_cell(name, state, *args)
::Cell::Base.render_cell_for(FakeCell.new, name, state, *args)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment