XRBSourceXRBTemplateAssembler

class Assembler

Definitions

def text(text)

Output raw text to the template. Raw text should be escaped, e.g. it can't contain tags or other special characters.

Implementation

def text(text)
	# We have to use an approach which preserves newlines and tabs as raw characters.
	text = text.gsub("'", "\\\\'")
	@code << "#{OUT}.raw('#{text}');"
end

def instruction(text, postfix = nil)

Output a ruby expression (or part of).

Implementation

def instruction(text, postfix = nil)
	@code << text << (postfix || ";")
end

def expression(code)

Output a string interpolation.

Implementation

def expression(code)
	@code << "#{OUT}<<(#{code});"
end