class SemverBump::VersionFile
Constants
- LINE_MATCH
Attributes
semver[RW]
Public Class Methods
new(filepath)
click to toggle source
# File lib/semver_bump/version_file.rb, line 8 def initialize(filepath) @filepath = filepath setup end
Public Instance Methods
replace()
click to toggle source
# File lib/semver_bump/version_file.rb, line 29 def replace replace = @text.gsub(Regexp.new(version_string), semver.to_s) File.open(@filepath, "w") {|file| file.puts replace} semver.to_s end
setup()
click to toggle source
# File lib/semver_bump/version_file.rb, line 13 def setup @text = File.read(@filepath) @semver = SemVer.new(version_string) end
version_string()
click to toggle source
# File lib/semver_bump/version_file.rb, line 25 def version_string LINE_MATCH.match(@text).captures.first end