Class: MetatagCop::Builders::Csv

Inherits:
Object
  • Object
show all
Defined in:
lib/metatag_cop/builders/csv.rb

Class Method Summary collapse

Class Method Details

.build(file_path) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/metatag_cop/builders/csv.rb', line 7

def self.build(file_path)
  records = []
  CSV.table(file_path).each do |row|
    records.push MetatagCop::Models::Csv.new(
      url: row[:url],
      title: row[:title],
      description: row[:description],
      keywords: row[:keywords],
      h1: row[:h1]
    )
  end
  records
end