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_bundle: TargetBundle.new, 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_bundle: TargetBundle.new, patched_versions: []) ⇒ RubyVersion
Returns a new instance of RubyVersion.
11 12 13 14 15 16 |
# File 'lib/bundler/patch/ruby_version.rb', line 11 def initialize(target_bundle: TargetBundle.new, patched_versions: []) super(target_file: target_bundle.gemfile, target_dir: target_bundle.dir, regexes: regexes, patched_versions: patched_versions) end |
Class Method Details
.files ⇒ Object
5 6 7 8 9 |
# File 'lib/bundler/patch/ruby_version.rb', line 5 def self.files @files ||= { '.ruby-version' => [/.*/] } end |
Instance Method Details
#update ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/bundler/patch/ruby_version.rb', line 18 def update hash = self.class.files.dup hash[@target_file.dup] = RUBY_VERSION_LINE_REGEXPS hash.each_pair do |file, regexes| @target_file = file @regexes = regexes file_replace end end |