Class: RootRequest
- Inherits:
-
AppRequest
- Object
- Liza::Unit
- Liza::Controller
- WebSystem::Request
- AppRequest
- RootRequest
- Defined in:
- app/web/requests/root_request.rb
Instance Attribute Summary
Attributes inherited from Liza::Controller
Class Method Summary collapse
-
.call(env) ⇒ Object
NOTE: There's a bug in this file.
- .render_action_index ⇒ Object
- .render_action_not_found(action) ⇒ Object
Methods inherited from Liza::Controller
#`, `, attr_accessor, attr_reader, attr_writer, #attrs, box, #box, color, division, division!, division?, inherited, menv_accessor, menv_reader, menv_writer, on_connected, panel, #panel, plural, require, requirements, sh, #sh, singular, subsystem, subsystem!, subsystem?, subsystem_token, token
Methods inherited from Liza::Unit
_erbs_for, #add, add, cl, #cl, class_methods_defined, const_added, const_missing, constants_defined, define_error, descendants_select, division, erbs_available, erbs_defined, erbs_for, errors, #fetch, fetch, get, #get, instance_methods_defined, log, #log, log?, #log?, #log_array, log_array, log_hash, #log_hash, #log_level, log_level, #log_level?, log_level?, log_levels, #log_levels, #log_render_convert, #log_render_format, #log_render_in, #log_render_out, method_added, methods_defined, namespace, part, raise_error, #raise_error, reload!, #reload!, #render, #render!, #render_stack, renderable_formats_for, renderable_names, section, sections, #set, set, #settings, settings, singleton_method_added, sleep, #sleep, stick, #stick, sticks, #sticks, subclasses_select, subunits, system, #system, system?, test_class, time_diff, #time_diff
Class Method Details
.call(env) ⇒ Object
NOTE: There's a bug in this file. Can you find it?
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/web/requests/root_request.rb', line 4 def self.call env super action = env["LIZA_ACTION"] # @status = 200 @headers = { "Framework" => "Liza #{Lizarb::VERSION}" } @body = "" if action == "index" render_action_index else @status = 404 render_action_not_found action end [@status, @headers, [@body]] rescue => e @status = 500 @body = "#{e.class} - #{e.}" log @status [@status, @headers, [@body]] end |
.render_action_index ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/web/requests/root_request.rb', line 34 def self.render_action_index h1 = "Ruby Works!" @body = <<~CODE <html> <head> <title>Ruby</title> <link rel="stylesheet" href="/assets/app.css" /> <script type="application/javascript" src="/assets/app.js"></script> </head> <body> <h1>#{h1}</h1> </body> </html> CODE end |
.render_action_not_found(action) ⇒ Object
51 52 53 |
# File 'app/web/requests/root_request.rb', line 51 def self.render_action_not_found action @body = "Ruby couldn't find your page! action: #{action}" end |