Sha256: 0a4140971077606bfe22709c7dbf0976db7d13febd84aefa106660ad7925d4aa

Contents?: true

Size: 1012 Bytes

Versions: 4

Compression:

Stored size: 1012 Bytes

Contents

require 'rubypython'

# A quick way to active <em>Legacy Mode</em> 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
module RubyPython::LegacyMode
  # Enables +RubyPython.legacy_mode+.
  def self.setup_legacy
    RubyPython.legacy_mode = true
  end

  # Disables +RubyPython.legacy_mode+.
  def self.teardown_legacy
    RubyPython.legacy_mode = false
  end
end

RubyPython::LegacyMode.setup_legacy

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubypython-0.5.3 lib/rubypython/legacy.rb
rubypython-0.5.2 lib/rubypython/legacy.rb
rubypython-0.5.1 lib/rubypython/legacy.rb
rubypython-0.5.0 lib/rubypython/legacy.rb