module Rear
Constants
- CONTROLLERS
Public Class Methods
app()
click to toggle source
# File lib/rear/rear.rb, line 59 def app @app ||= E.new.mount(controllers) end
call(env)
click to toggle source
# File lib/rear/rear.rb, line 65 def call env app.call env end
controllers()
click to toggle source
# File lib/rear/rear.rb, line 21 def controllers @controllers ||= begin MODELS.each_pair do |model,procs| model = RearUtils.extract_constant(model) controller = RearUtils.initialize_model_controller(model) procs.compact.each {|proc| controller.class_exec(model, &proc)} CONTROLLERS << controller end CONTROLLERS.uniq.each do |controller| controller.model && controller.assocs.each_value do |assocs| assocs.each_value do |assoc| if remote_model = assoc[:remote_model] CONTROLLERS << RearUtils.associated_model_controller(remote_model) end end end end MODELS.clear.freeze CONTROLLERS.unshift RearHomeController CONTROLLERS.uniq! CONTROLLERS.freeze end end
included(base)
click to toggle source
# File lib/rear/rear.rb, line 12 def included base if EUtils.is_app?(base) RearControllerSetup.init(base) CONTROLLERS << base else raise ArgumentError, '%s is not a Espresso controller' % base end end
register(*models, &proc)
click to toggle source
# File lib/rear/rear.rb, line 5 def register *models, &proc models.flatten.each do |model| (MODELS[model] ||= []).push(proc) end end
Also aliased as: setup
run(*args)
click to toggle source
# File lib/rear/rear.rb, line 69 def run *args app.run *args end