Class: VirtualKeywords::NotRewriter
- Inherits:
-
SexpProcessor
- Object
- SexpProcessor
- VirtualKeywords::NotRewriter
- Defined in:
- lib/virtual_keywords/keyword_rewriter.rb
Overview
SexpProcessor subclass that rewrites “not” expressions.
Instance Method Summary collapse
-
#initialize ⇒ NotRewriter
constructor
A new instance of NotRewriter.
-
#rewrite_not(expression) ⇒ Object
Rewrite “not” expressions (automatically called by SexpProcessor#process).
Constructor Details
#initialize ⇒ NotRewriter
Returns a new instance of NotRewriter.
119 120 121 122 |
# File 'lib/virtual_keywords/keyword_rewriter.rb', line 119 def initialize super self.strict = false end |
Instance Method Details
#rewrite_not(expression) ⇒ Object
Rewrite “not” expressions (automatically called by SexpProcessor#process)
Arguments:
expression: (Sexp) the :not sexp to rewrite.
Returns:
(Sexp): a sexp that instead calls REWRITTEN_KEYWORDS.call_not
131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/virtual_keywords/keyword_rewriter.rb', line 131 def rewrite_not(expression) value = expression[1] s(:call, s(:colon2, s(:const, :VirtualKeywords), :REWRITTEN_KEYWORDS ), :call_not, s(:array, s(:self), s(:iter, s(:fcall, :lambda), nil, value) ) ) end |