Module: Jeweler::VersionHelper::PlaintextExtension

Defined in:
lib/jeweler/version_helper.rb

Instance Method Summary collapse

Instance Method Details

#parse_plaintextObject



56
57
58
59
60
61
62
63
# File 'lib/jeweler/version_helper.rb', line 56

def parse_plaintext
  plaintext = read_plaintext.chomp
  if plaintext =~ /^(\d+)\.(\d+)\.(\d+)$/
    @major = $1.to_i
    @minor = $2.to_i
    @patch = $3.to_i
  end
end

#pathObject



73
74
75
# File 'lib/jeweler/version_helper.rb', line 73

def path
  plaintext_path
end

#read_plaintextObject



65
66
67
# File 'lib/jeweler/version_helper.rb', line 65

def read_plaintext
  File.read(plaintext_path)
end

#refreshObject



69
70
71
# File 'lib/jeweler/version_helper.rb', line 69

def refresh
  parse_plaintext
end

#writeObject



50
51
52
53
54
# File 'lib/jeweler/version_helper.rb', line 50

def write
  File.open(plaintext_path, 'w') do |file|
    file.puts to_s
  end
end