module RubyNext::Core

Constants

STRATEGIES

Attributes

strategy[R]

Public Class Methods

backports?() click to toggle source
# File lib/ruby-next/core.rb, line 122
def backports?
  strategy == :backports
end
core_ext?() click to toggle source
# File lib/ruby-next/core.rb, line 118
def core_ext?
  strategy == :core_ext || strategy == :backports
end
inject!(contents) click to toggle source

Inject `using RubyNext` at the top of the source code

# File lib/ruby-next/core.rb, line 131
def inject!(contents)
  if contents.frozen?
    contents = contents.sub(/^(\s*[^#\s].*)/, 'using RubyNext;\1')
  else
    contents.sub!(/^(\s*[^#\s].*)/, 'using RubyNext;\1')
  end
  contents
end
patch(...) click to toggle source
# File lib/ruby-next/core.rb, line 126
def patch(...)
  patches << Patch.new(...)
end
patches() click to toggle source
# File lib/ruby-next/core.rb, line 140
def patches
  @patches ||= Patches.new
end
refine?() click to toggle source
# File lib/ruby-next/core.rb, line 114
def refine?
  strategy == :refine
end
strategy=(val) click to toggle source
# File lib/ruby-next/core.rb, line 109
def strategy=(val)
  raise ArgumentError, "Unknown strategy: #{val}. Available: #{STRATEGIES.join(",")}" unless STRATEGIES.include?(val)
  @strategy = val
end