Top Level Namespace
Defined Under Namespace
Modules: Makanai
Instance Method Summary collapse
- #redirect_to(url) ⇒ Object
- #render(path, engine = Makanai::Settings.template_engine) ⇒ Object
- #router ⇒ Object
Instance Method Details
#redirect_to(url) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/makanai/dsl.rb', line 15 def redirect_to(url) Makanai::Response.new.tap do |response| response.status = 302 response.header = { 'Location' => url } end end |
#render(path, engine = Makanai::Settings.template_engine) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/makanai/dsl.rb', line 7 def render(path, engine = Makanai::Settings.template_engine) template_root_path = Makanai::Settings.template_full_path full_path = File.join(template_root_path, path.to_s) # NOTE: Get all instance variables in main by Hash locals = instance_variables.to_h { |name| [name, instance_variable_get(name)] } Makanai::Template.new(path: full_path, engine: engine, locals: locals).render end |