class RubyNext::Core::Patches

Registry for patches

Attributes

extensions[R]
refined[R]

Public Class Methods

new() click to toggle source
# File lib/ruby-next/core.rb, line 89
def initialize
  @names = Set.new
  @extensions = Hash.new { |h, k| h[k] = [] }
  @refined = Hash.new { |h, k| h[k] = [] }
end

Public Instance Methods

<<(patch) click to toggle source

Register new patch

# File lib/ruby-next/core.rb, line 96
def <<(patch)
  raise ArgumentError, "Patch already registered: #{patch.name}" if @names.include?(patch.name)
  @names << patch.name
  @extensions[patch.mod] << patch if patch.core_ext?
  patch.refineables.each { |r| @refined[r] << patch } unless patch.native?
end