Class: Spek::Versioner

Inherits:
Object
  • Object
show all
Defined in:
lib/spek/versioner.rb

Overview

Updates a gem specification’s version.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(loader: Loader.new) ⇒ Versioner

Returns a new instance of Versioner.



12
13
14
# File 'lib/spek/versioner.rb', line 12

def initialize loader: Loader.new
  @loader = loader
end

Class Method Details

.call(version, path) ⇒ Object



10
# File 'lib/spek/versioner.rb', line 10

def self.call(version, path, ...) = new(...).call version, path

Instance Method Details

#call(version, path) ⇒ Object



16
17
18
19
# File 'lib/spek/versioner.rb', line 16

def call version, path
  Pathname(path).rewrite { |content| content.sub(/version.+\n/, %(version = "#{version}"\n)) }
  loader.call path
end