Class: Unparser::Writer::Binary
Constant Summary
collapse
- OPERATOR_TOKENS =
{
and: '&&',
or: '||'
}.freeze
- KEYWORD_TOKENS =
{
and: 'and',
or: 'or'
}.freeze
- KEYWORD_SYMBOLS =
{
and: :kAND,
or: :kOR
}.freeze
- OPERATOR_SYMBOLS =
{
and: :tANDOP,
or: :tOROP
}.freeze
- MAP =
{
kAND: 'and',
kOR: 'or',
tOROP: '||',
tANDOP: '&&'
}.freeze
- NEED_KEYWORD =
%i[return break next].freeze
Constants included
from Generation
Generation::EXTRA_NL
Instance Method Summary
collapse
included
Methods included from Generation
#emit_heredoc_reminders, #write_to_buffer
#n, #n?, #s, #unwrap_single_begin
Instance Method Details
#dispatch ⇒ Object
54
55
56
57
58
|
# File 'lib/unparser/writer/binary.rb', line 54
def dispatch
left_emitter.write_to_buffer
write(' ', MAP.fetch(effective_symbol), ' ')
visit(right)
end
|
#emit_operator ⇒ Object
46
47
48
|
# File 'lib/unparser/writer/binary.rb', line 46
def emit_operator
emit_with(OPERATOR_TOKENS)
end
|
#symbol_name ⇒ Object
50
51
52
|
# File 'lib/unparser/writer/binary.rb', line 50
def symbol_name
true
end
|