Method: AbstractAnalyzer::View.to_app

Defined in:
lib/view.rb

.to_appObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/view.rb', line 35

def to_app
  routes, controller = @_routes, self

  # From Railsnatra ;)
  # We're using Usher as a router for this project. To
  # simplify things, we just used the rack interface to
  # router and it's DSL.
  app = Usher::Interface.for(:rack) do
    routes.each do |route|
      conditions = {:request_method => route[:method]}
      add(route[:uri], :conditions => conditions.merge(route[:options])).
        to(controller.action(route[:action]))
    end
  end

  app
end