Module: Rubinius::ToolSets

Defined in:
lib/rubinius/toolset.rb,
lib/rubinius/toolset/version.rb

Constant Summary collapse

VERSION =
"2.3.0"

Class Method Summary collapse

Class Method Details

.create(name = nil) ⇒ Object

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



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/rubinius/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
      $LOADED_FEATURES.clear

      yield @current

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

  @current
end

.currentObject

Returns the current ToolSet.



34
35
36
# File 'lib/rubinius/toolset.rb', line 34

def self.current
  @current ||= create
end