Class: VirtualKeywords::OrRewriter
- Inherits:
-
SexpProcessor
- Object
- SexpProcessor
- VirtualKeywords::OrRewriter
- Defined in:
- lib/virtual_keywords/keyword_rewriter.rb
Overview
SexpProcessor subclass that rewrites “or” expressions.
Instance Method Summary collapse
-
#initialize ⇒ OrRewriter
constructor
A new instance of OrRewriter.
-
#rewrite_or(expression) ⇒ Object
Rewrite “or” expressions (automatically called by SexpProcessor#process).
Constructor Details
#initialize ⇒ OrRewriter
Returns a new instance of OrRewriter.
97 98 99 100 |
# File 'lib/virtual_keywords/keyword_rewriter.rb', line 97 def initialize super self.strict = false end |
Instance Method Details
#rewrite_or(expression) ⇒ Object
Rewrite “or” expressions (automatically called by SexpProcessor#process)
Arguments:
expression: (Sexp) the :or sexp to rewrite.
Returns:
(Sexp): a sexp that instead calls REWRITTEN_KEYWORDS.call_or
109 110 111 112 113 114 |
# File 'lib/virtual_keywords/keyword_rewriter.rb', line 109 def rewrite_or(expression) first = expression[1] second = expression[2] VirtualKeywords.call_operator_replacement(:call_or, first, second) end |