Module: Jeweler::VersionHelper::PlaintextExtension

Defined in:
lib/jeweler/version_helper.rb

Instance Method Summary collapse

Instance Method Details

#parse_plaintextObject



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

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



71
72
73
# File 'lib/jeweler/version_helper.rb', line 71

def path
  plaintext_path
end

#read_plaintextObject



63
64
65
# File 'lib/jeweler/version_helper.rb', line 63

def read_plaintext
  File.read(plaintext_path)
end

#refreshObject



67
68
69
# File 'lib/jeweler/version_helper.rb', line 67

def refresh
  parse_plaintext
end

#writeObject



48
49
50
51
52
# File 'lib/jeweler/version_helper.rb', line 48

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