Module: Jeweler::VersionHelper::PlaintextExtension

Defined in:
lib/jeweler/version_helper.rb

Instance Method Summary collapse

Instance Method Details

#parse_plaintextObject



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

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



75
76
77
# File 'lib/jeweler/version_helper.rb', line 75

def path
  plaintext_path
end

#read_plaintextObject



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

def read_plaintext
  File.read(plaintext_path)
end

#refreshObject



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

def refresh
  parse_plaintext
end

#writeObject



52
53
54
55
56
# File 'lib/jeweler/version_helper.rb', line 52

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