Class: Mxrb::Compiler::PageBundleCompiler

Inherits:
Object
  • Object
show all
Includes:
ModelValues
Defined in:
lib/mxrb/compiler/page_bundle_compiler.rb

Overview

Converts the web-page subset of the source model into a Runtime-loadable ES module. rubocop:disable Metrics, Style/MultilineBlockChain

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ PageBundleCompiler

Returns a new instance of PageBundleCompiler.



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/mxrb/compiler/page_bundle_compiler.rb', line 14

def initialize(source)
  @source = source
  @unsupported = []
  @unsupported_custom = []
  @data_view_scopes = []
  @list_scopes = []
  @snippet_scopes = []
  @snippet_stack = []
  @snippet_documents = []
  @uses_conditional = false
  @uses_dynamic_class = false
end

Instance Method Details

#compile(unit) ⇒ Object



27
28
29
30
# File 'lib/mxrb/compiler/page_bundle_compiler.rb', line 27

def compile(unit)
  prepare_compile(unit, 'p')
  build_bundle(module_source(page_content))
end

#compile_layout(unit) ⇒ Object



32
33
34
35
36
37
# File 'lib/mxrb/compiler/page_bundle_compiler.rb', line 32

def compile_layout(unit)
  prepare_compile(unit, 'l')
  @layout_mode = true
  widgets = array(unit.document.dig('Content', 'Widgets'))
  build_bundle(layout_module_source(children(widgets)))
end