Class: Refill::Translator

Inherits:
Object
  • Object
show all
Defined in:
lib/refill/translator.rb

Instance Method Summary collapse

Constructor Details

#initialize(output:) ⇒ Translator

Returns a new instance of Translator.



3
4
5
# File 'lib/refill/translator.rb', line 3

def initialize output: 
  @output = output
end

Instance Method Details

#translate(node) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/refill/translator.rb', line 7

def translate node
  # TODO logger
  puts "translating node #{node.class}"

  case node
  when AST::Expressions
    translate_and_write_expressions node
  else
    raise 'UnknownNode'
  end
end