Class: Akaza::Ruby2ws::Transpiler
- Inherits:
-
Object
- Object
- Akaza::Ruby2ws::Transpiler
- Defined in:
- lib/akaza/ruby2ws.rb
Instance Method Summary collapse
-
#initialize(ruby_code) ⇒ Transpiler
constructor
A new instance of Transpiler.
- #transpile ⇒ Object
Constructor Details
#initialize(ruby_code) ⇒ Transpiler
Returns a new instance of Transpiler.
45 46 47 48 |
# File 'lib/akaza/ruby2ws.rb', line 45 def initialize(ruby_code) @ruby_code = ruby_code @label_index = 0 end |
Instance Method Details
#transpile ⇒ Object
50 51 52 53 54 |
# File 'lib/akaza/ruby2ws.rb', line 50 def transpile ast = RubyVM::AbstractSyntaxTree.parse(@ruby_code) commands = ast_to_commands(ast, main: true) commands_to_ws(commands) end |