Sha256: 2b06e67459d302d1adce28829d680e61d8f5627bef5a3b74cd653c2a33732907

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

# 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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rerb-0.1.1 sig/rerb/compiler.rbs