Module: Antlers

Extended by:
Queries
Defined in:
lib/lexer.rb,
lib/parser.rb,
lib/antlers.rb,
lib/version.rb,
lib/modules/props.rb,
lib/nodes/for_node.rb,
lib/nodes/var_node.rb,
lib/nodes/form_node.rb,
lib/nodes/prop_node.rb,
lib/nodes/root_node.rb,
lib/nodes/slot_node.rb,
lib/support/queries.rb,
lib/nodes/yield_node.rb,
lib/modules/namespace.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: Namespace, Props, Queries, Variables Classes: AntlerNode, BranchNode, ForNode, FormNode, LeafNode, Lexer, LexerParseError, NodeFactory, Parser, PropNode, RootNode, SlotNode, VarNode, YieldNode

Constant Summary collapse

VERSION =
'0.7.0'

Class Method Summary collapse

Methods included from Queries

user_defined_string?, wrapped_in?

Class Method Details

.ast(template:, namespace: nil) ⇒ Object



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

def ast(template:, namespace: nil)
  return template unless template.include?('<{') || template.include?('{')

  sequence = Lexer.new.parse(template)
  Parser.new(namespace:).parse(sequence:)
end

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



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

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