Module: RubyPython::LegacyMode

Defined in:
lib/rubypython/legacy.rb

Overview

A quick way to active Legacy Mode for a project. Requiring +‘rubypython/legacy’ automatically activates RubyPython.legacy_mode on the project.

This mode may be phased out for RubyPython 1.0.

Default

require 'rubypython'

RubyPython.session do
  string = RubyPython.import 'string'
  ascii_letters = string.ascii_letters
  puts ascii_letters.isalpha # => True
  puts ascii_letters.rubify.isalpha # throws NoMethodError
end

Legacy Mode

require 'rubypython/legacy'

RubyPython.session do
  string = RubyPython.import 'string'
  ascii_letters = string.ascii_letters
  puts ascii_letters.isalpha # throws NoMethodError
end

Class Method Summary collapse

Class Method Details

.setup_legacyObject

Enables RubyPython.legacy_mode.



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

def self.setup_legacy
  RubyPython.legacy_mode = true
end

.teardown_legacyObject

Disables RubyPython.legacy_mode.



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

def self.teardown_legacy
  RubyPython.legacy_mode = false
end