Class: Porous::Application

Inherits:
Object
  • Object
show all
Includes:
Component
Defined in:
lib/porous/application.rb

Constant Summary

Constants included from VirtualDOM::DOM

VirtualDOM::DOM::HTML_TAGS, VirtualDOM::DOM::SVG_TAGS

Instance Attribute Summary

Attributes included from Injection

#injections

Instance Method Summary collapse

Methods included from Component

included, #initialize, #props, #to_s, #with_props

Methods included from Injection

#init, #init_injections, #inject, #with_root_component

Methods included from Component::Render

#before_render, #render_virtual_dom

Methods included from Component::Virtual

#component

Methods included from VirtualDOM::DOM

#class_names, #merge_string, #method_missing, #process_params, #process_tag, #text, #to_vnode

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class VirtualDOM::DOM

Instance Method Details

#renderObject

rubocop:disable Metrics/AbcSize



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/porous/application.rb', line 8

def render
  html do
    head do
      meta charset: 'UTF-8'
      meta name: 'viewport', content: 'width=device-width, initial-scale=1.0'

      if props[:title]
        title do
          text props[:title]
        end
      end
      meta name: 'description', content: props[:description] if props[:description]

      script src: '/porous.js'
      script src: '/app.js'
      script src: 'https://cdn.tailwindcss.com'
      link rel: 'icon', href: '/favicon.svg'
    end

    body class: 'bg-gray-50 dark:bg-gray-900' do
      component Porous::Router, props: { path: props[:path], query: props[:query] }
    end
  end
end