Class: AdLint::Postfilter::MessageFileContent
- Inherits:
-
FilteringContent
- Object
- Array
- FilteringContent
- AdLint::Postfilter::MessageFileContent
- Defined in:
- lib/adlint/postfilter/content.rb
Instance Method Summary collapse
-
#initialize(fpath) ⇒ MessageFileContent
constructor
A new instance of MessageFileContent.
- #overwrite! ⇒ Object
Constructor Details
#initialize(fpath) ⇒ MessageFileContent
Returns a new instance of MessageFileContent.
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/adlint/postfilter/content.rb', line 46 def initialize(fpath) @fpath = fpath lines = File.read(fpath).lines.each_with_object([]) { |line, ary| if line[0] == "V" ary.push(OrdinaryLine.new(line.chomp)) else ary.push(CsvMessageLine.new(line.chomp)) end } super(lines) end |
Instance Method Details
#overwrite! ⇒ Object
58 59 60 |
# File 'lib/adlint/postfilter/content.rb', line 58 def overwrite! File.open(@fpath, "w") { |io| io.puts self.compact } end |