Class: Cyberweb::HtmlTemplatePoweredByRack

Inherits:
Object
  • Object
show all
Defined in:
lib/cyberweb/experimental/html_template_powered_by_rack.rb

Overview

Cyberweb::HtmlTemplatePoweredByRack

Constant Summary collapse

IMAGE_MINZI =
#

IMAGE_MINZI

#
'/home/x/data/images/fotos/cats_and_dogs/minzi/'\
'16.11.2021_Minzi_im_Bad_in_Wohnung_1_Marchettigasse.jpg'

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object

#

call

A rack-object returns three elements:

(1) The status
(2) the headers
(3) the body
#


40
41
42
43
44
45
46
47
48
# File 'lib/cyberweb/experimental/html_template_powered_by_rack.rb', line 40

def call(env)
  [
    200,
    Cyberweb.content_type_HTML,
    [
      return_the_message_body(env)
    ]
  ]
end

#return_the_message_body(env) ⇒ Object

#

return_the_message_body

#


53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/cyberweb/experimental/html_template_powered_by_rack.rb', line 53

def return_the_message_body(env)
  Cyberweb.store_rack_env(env) # Keep a reference.
  # _ = 'Hello world '+(42+42).to_s+
  #     '<br>The environment contains '+
  #     env.keys.size.to_s+' entries.'.dup
  # env.keys.each {|this_key|
  #   _ << "#{this_key}<br>\n"
  # }
  # _ << 'Full URL:  '+Cyberweb.rack_request_URI?+'<br>'
  # _ << 'Full path: '+Cyberweb.rack_path?+'<br>'
  # if Cyberweb.rack_path?.end_with? 'minzi'
  #   # 'YUP THIS IS MINZI'
  #   img_encoded = Base64.encode64(File.read(IMAGE_MINZI))
  #   der_minzi = "<img src='data:image/*;base64, #{img_encoded}'/>"
  #   _ << der_minzi
  # end
  # x = Cyberweb.new_html_template(
  #   title: 'Yo there',
  #   body: _
  # )
  x = Cyberweb::WebObject.new { :is_a_rack_application } 
  # x.do_use_jquery
  # _ << '<br>The class is: '+x.class.to_s+'<br>'
  # _ << 'Do we use jquery: '+x.jquery?.to_s
  x.evaluate_from_this_file_via_beautiful_url(
    Cyberweb.rack_parameters?.delete('/').to_sym
  )
  x.internal_render
  return x.main_string?
end