Module: Antlers

Extended by:
Queries
Defined in:
lib/lexer.rb,
lib/parser.rb,
lib/antlers.rb,
lib/queries.rb,
lib/version.rb,
lib/modules/props.rb,
lib/nodes/for_node.rb,
lib/nodes/var_node.rb,
lib/nodes/prop_node.rb,
lib/nodes/root_node.rb,
lib/nodes/slot_node.rb,
lib/nodes/yield_node.rb,
lib/modules/variables.rb,
lib/interfaces/leaf_node.rb,
lib/factories/node_factory.rb,
lib/interfaces/antler_node.rb,
lib/interfaces/branch_node.rb

Defined Under Namespace

Modules: Parser, Props, Queries, Variables Classes: AntlerNode, BranchNode, ForNode, LeafNode, Lexer, LexerParseError, NodeFactory, PropNode, RootNode, SlotNode, VarNode, YieldNode

Constant Summary collapse

VERSION =
'0.3.0'

Class Method Summary collapse

Methods included from Queries

user_defined_string?, wrapped_in?

Class Method Details

.ast(template) ⇒ Object



8
9
10
11
12
13
# File 'lib/antlers.rb', line 8

def ast(template)
  return template unless template.include?('<{') || template.include?('{')

  lexemes = Lexer.new.parse(template)
  Parser.parse(lexemes)
end

.render(ast:, current_binding:, parent_binding: nil, slot_node: nil, namespace: nil) ⇒ Object



15
16
17
# File 'lib/antlers.rb', line 15

def render(ast:, current_binding:, parent_binding: nil, slot_node: nil, namespace: nil)
  ast.render(current_binding:, parent_binding:, slot_node:, namespace:)
end