Completed
Push — master ( ebf929...475333 )
by Marcelo
01:06
created

CsvParser.column_separator()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
1
require "csv"
2
3
module Koine
4
  module Csv
5
    class CsvParser
6
      def initialize(options = {})
7
        defaults = { column_separator: ";" }
8
        options = defaults.merge(options)
9
        @parser_options = { col_sep: options[:column_separator] }
10
      end
11
12
      def parse(contents, &block)
13
        CSV.parse(contents, parser_options, &block)
14
      end
15
16
      protected
17
18
      def column_separator
19
        parser_options[:col_sep]
20
      end
21
22
      attr_reader :parser_options
23
    end
24
  end
25
end
26