Class: Bundler::Patch::RubyVersion
- Inherits:
-
UpdateSpec
- Object
- UpdateSpec
- Bundler::Patch::RubyVersion
- Defined in:
- lib/bundler/patch/ruby_version.rb
Constant Summary collapse
- RUBY_VERSION_LINE_REGEXPS =
[/ruby\s+["'](.*)['"]/]
Instance Attribute Summary
Attributes inherited from UpdateSpec
#patched_versions, #regexes, #target_dir, #target_file
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(target_dir: Dir.pwd, patched_versions: []) ⇒ RubyVersion
constructor
A new instance of RubyVersion.
- #update ⇒ Object
Methods inherited from UpdateSpec
#calc_new_version, #file_replace, #target_path_fn, #update_to_new_version, #verbose_puts
Constructor Details
#initialize(target_dir: Dir.pwd, patched_versions: []) ⇒ RubyVersion
Returns a new instance of RubyVersion.
13 14 15 16 17 18 |
# File 'lib/bundler/patch/ruby_version.rb', line 13 def initialize(target_dir: Dir.pwd, patched_versions: []) super(target_file: target_file, target_dir: target_dir, regexes: regexes, patched_versions: patched_versions) end |
Class Method Details
.files ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/bundler/patch/ruby_version.rb', line 5 def self.files { '.ruby-version' => [/.*/], 'Gemfile' => RUBY_VERSION_LINE_REGEXPS, 'gems.rb' => RUBY_VERSION_LINE_REGEXPS, } end |
Instance Method Details
#update ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/bundler/patch/ruby_version.rb', line 20 def update self.class.files.each_pair do |file, regexes| @target_file = file @regexes = regexes file_replace end end |