module Rubinius::ToolSets

Constants

VERSION

Public Class Methods

create(name=nil) { |current| ... } click to toggle source

Create a new ToolSet, with an optional name. The ToolSet is yielded to the optional block.

# File lib/rubinius/code/toolset.rb, line 7
def self.create(name=nil)
  @current = Module.new
  @current.const_set :ToolSet, @current

  if name
    name = name.to_s.split("_").map { |x| x.capitalize }.join
    const_set name, @current
  end

  if block_given?
    begin
      loaded_features = $LOADED_FEATURES.dup
      $LOADED_FEATURES.clear

      yield @current

      @current.send :include, ::CodeTools
      ::Object.send :remove_const, :CodeTools
    ensure
      $LOADED_FEATURES.replace loaded_features
    end
  end

  @current
end
current() click to toggle source

Returns the current ToolSet.

# File lib/rubinius/code/toolset.rb, line 34
def self.current
  @current ||= create
end