Module: RubyPython::LegacyMode

Defined in:
lib/rubypython/legacy.rb

Overview

A quick way to activate legacy mode for your project. Requiring ‘rubypython/legacy’ automatically activates legacy_mode as described in the documentation for RubyPython. If you wish to run your project in legacy mode you can require ‘rubypython/legacy’ instead of ‘rubypython’

Examples:

Default Behavior

irb(main):001:0> require 'rubypython'
=> true
irb(main):002:0> RubyPython.start
=> true
irb(main):003:0> RubyPython::PyMain.float(42).is_a? RubyPython::RubyPyProxy
=> true
irb(main):004:0> RubyPython.stop
=> true

Legacy Mode

irb(main):001:0> require 'rubypython/legacy'
=> true
irb(main):002:0> RubyPython.start
=> true
irb(main):003:0> RubyPython::PyMain.float(42).is_a? Float
=> true
irb(main):004:0> RubyPython.stop
=> true

Class Method Summary collapse

Class Method Details

.setup_legacyObject



30
31
32
# File 'lib/rubypython/legacy.rb', line 30

def setup_legacy
  RubyPython.legacy_mode = true
end

.teardown_legacyObject



34
35
36
# File 'lib/rubypython/legacy.rb', line 34

def teardown_legacy
  RubyPython.legacy_mode = false
end