mjacobus/deutsch

View on GitHub
lib/factories/articles_repository_factory.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Factories
  class ArticlesRepositoryFactory < Nurse::ServiceFactory
    def dependency_key
      :articles_repository
    end

    def create_service(container, filename: 'articles')
      ArticlesRepository.new(
        file_path: Hanami.root.join("data", File.basename("#{filename}.csv")),
        csv_parser: Koine::Csv::NamedColumnsParser.new(
          col_sep: ",",
          quote_char: '"'
        )
      )
    end
  end
end