lib/codeowners/checker/file_as_array.rb in codeowners-checker-1.0.0 vs lib/codeowners/checker/file_as_array.rb in codeowners-checker-1.0.1
- old
+ new
@@ -7,15 +7,18 @@
def initialize(file)
@file = file
@target_dir, = File.split(@file)
end
+ # @return <Array> of lines chomped
def content
@content ||= File.readlines(@file).map(&:chomp)
rescue Errno::ENOENT
@content = []
end
+ # Save content to the @file
+ # Creates the directory of the file if needed
def content=(content)
@content = content
Dir.mkdir(@target_dir) unless Dir.exist?(@target_dir)