Module: Yadriggy::AstHelper
- Included in:
- ArrayLiteral, ArrayRef, BeginEnd, Binary, Break, Call, Conditional, ConstPathRef, Exprs, ForLoop, HashLiteral, Loop, ModuleDef, Parameters, Paren, Program, Rescue, Return, StringInterpolation, SymbolLiteral, Unary
- Defined in:
- lib/yadriggy/ast.rb
Overview
Helper module
Instance Method Summary collapse
-
#has_tag?(s, *tags) ⇒ Array
The S-expression if it starts with the tag.
-
#to_node(s) ⇒ ASTnode
An AST.
-
#to_nodes(s) ⇒ Array<ASTnode>
ASTs.
Instance Method Details
#has_tag?(s, *tags) ⇒ Array
Returns the S-expression if it starts with the tag. Otherwise, raise an error.
310 311 312 313 |
# File 'lib/yadriggy/ast.rb', line 310 def has_tag?(s, *) raise "s-exp is not :#{.join(", ")}. #{s}" if !s.nil? && !.include?(s[0]) s end |