# Classes
module BetterHtml
class Parser
def initialize: (untyped buffer) -> void
def ast: -> AST::Node
end
module AST
class Node
attr_reader children: Array[Node | String]
attr_reader type: Symbol
end
end
end
module RERB
# Compile ERB into ruby.wasm compatible code
class Compiler
class Frame < Data
attr_reader name: String
attr_reader elems: Array[IR::node]
def initialize: (String, ?Array[IR::node]) -> void
end
@counter: Integer
@parser: BetterHtml::Parser
@viewmodel_name: String
@name_hash: Hash[String, Integer]
@root_elem_name: String
@frames: Array[Frame]
def initialize: (String source,
String viewmodel_name,
?String root_elem_name) -> void
def compile: () -> String
def compile_body: () -> String
private
def create_parser: (String source) -> BetterHtml::Parser
def compile_ast: (BetterHtml::AST::Node | String node) -> IR::node
def join_text_children: (Array[IR::node | nil] children) -> String
def dom_to_str: (IR::node elem, ?interpolate: bool) -> String
def collect_frame: (Frame frame, ?interpolate: bool) -> untyped
def collect_children: (Array[BetterHtml::AST::Node] children, ?interpolate: bool) -> untyped
def current_frame: () -> Frame
def generate_el_name: (String) -> String
end
end