Module: Mojito::Controllers

Defined in:
lib/mojito/controllers.rb,
lib/mojito/controllers/method.rb,
lib/mojito/controllers/runtime.rb,
lib/mojito/controllers/sinatra.rb,
lib/mojito/controllers/entities.rb

Defined Under Namespace

Modules: Entities, Method, Runtime, Sinatra

Class Method Summary collapse

Class Method Details

.method_controller(*modules, &block) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/mojito/controllers/method.rb', line 52

def self.method_controller(*modules, &block)
	Class.new.tap do |controller|
		controller.instance_exec do
			include Mojito::Base
			include Mojito::Controllers::Method
			modules.each do |mod|
				include mod
			end
		end
		controller.class_exec &block if block
	end
end

.runtime_controller(*modules, &block) ⇒ Object



69
70
71
72
73
74
75
76
77
78
# File 'lib/mojito/controllers/runtime.rb', line 69

def self.runtime_controller(*modules, &block)
	Class.new do
		include Mojito
		include Mojito::C::Runtime
		modules.each do |mod|
			include mod
		end
		routes &block
	end
end