Class: VirtualKeywords::AndRewriter
- Inherits:
-
SexpProcessor
- Object
- SexpProcessor
- VirtualKeywords::AndRewriter
- Defined in:
- lib/virtual_keywords/keyword_rewriter.rb
Overview
SexpProcessor subclass that rewrites “and” expressions.
Instance Method Summary collapse
-
#initialize ⇒ AndRewriter
constructor
A new instance of AndRewriter.
-
#rewrite_and(expression) ⇒ Object
Rewrite “and” expressions (automatically called by SexpProcessor#process).
Constructor Details
#initialize ⇒ AndRewriter
Returns a new instance of AndRewriter.
75 76 77 78 |
# File 'lib/virtual_keywords/keyword_rewriter.rb', line 75 def initialize super self.strict = false end |
Instance Method Details
#rewrite_and(expression) ⇒ Object
Rewrite “and” expressions (automatically called by SexpProcessor#process)
Arguments:
expression: (Sexp) the :and sexp to rewrite.
Returns:
(Sexp): a sexp that instead calls REWRITTEN_KEYWORDS.call_and
87 88 89 90 91 92 |
# File 'lib/virtual_keywords/keyword_rewriter.rb', line 87 def rewrite_and(expression) first = expression[1] second = expression[2] VirtualKeywords.call_operator_replacement(:call_and, first, second) end |