Top Level Namespace

Defined Under Namespace

Modules: RaddDjur

Instance Method Summary collapse

Instance Method Details

#with_tailcall_optimizationObject



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/radd_djur.rb', line 1

def with_tailcall_optimization
  if defined?(RubyVM)
    old_option = RubyVM::InstructionSequence.compile_option
    RubyVM::InstructionSequence.compile_option = {
      trace_instruction: false,
      tailcall_optimization: true
    }
  end
  begin
    yield
  ensure
    if defined?(RubyVM)
      RubyVM::InstructionSequence.compile_option = old_option
    end
  end
end