lib/buildmaster/build_number_file.rb in BuildMaster-0.8.1 vs lib/buildmaster/build_number_file.rb in BuildMaster-0.9.0
- old
+ new
@@ -3,25 +3,15 @@
class BuildNumberFile
attr_reader :number
def initialize(path)
@path = path
- @number = load_content().chomp!.to_i
+ @number = @path.load().strip.to_i
end
def increase_build
@number = @number + 1
- save_content
+ @path.save(@number)
end
- private
- def load_content()
- content = nil
- File.open(@path, 'r') {|file| content = file.gets}
- return content
- end
-
- def save_content
- File.open(@path, 'w') {|file| file.puts @number}
- end
end
end
\ No newline at end of file