class Unparser::Emitter

Emitter base class

def self.emitter(buffer:, explicit_encoding:, comments:, node:, local_variable_scope:)

Other tags:
    Api: - private

Returns:
  • (Emitter) -
def self.emitter(buffer:, explicit_encoding:, comments:, node:, local_variable_scope:)
  type = node.type
  klass = REGISTRY.fetch(type) do
    fail UnknownNodeError, "Unknown node type: #{type.inspect}"
  end
  klass.new(
    buffer:,
    comments:,
    explicit_encoding:,
    local_variable_scope:,
    node:
  )
end

def self.handle(*types)

Other tags:
    Api: - private

Returns:
  • (undefined) -

Parameters:
  • types (Symbol) --
def self.handle(*types)
  types.each do |type|
    fail "Handler for type: #{type} already registered" if REGISTRY.key?(type)
    REGISTRY[type] = self
  end
end

def emit_mlhs

def emit_mlhs
  dispatch
end

def node_type

def node_type
  node.type
end