Created
March 28, 2011 22:03
-
-
Save thatdutchguy/891389 to your computer and use it in GitHub Desktop.
CellRouter
This file contains 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
# 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