Class: CsvFormatGuesser
- Inherits:
-
Object
- Object
- CsvFormatGuesser
- Defined in:
- lib/csv_format_guesser.rb
Constant Summary collapse
- VERSION =
'0.0.1'
- PREVIEW_LINES =
100
- PREVIEW_BYTES =
10 * 1024
- DEFAULT_ENCODING =
'UTF-8'.freeze
- DEFAULT_QUOTE_CHAR =
"\x00".freeze
Instance Attribute Summary collapse
-
#col_sep ⇒ Object
readonly
Returns the value of attribute col_sep.
-
#encoding ⇒ Object
readonly
Returns the value of attribute encoding.
-
#quote_char ⇒ Object
readonly
Returns the value of attribute quote_char.
Instance Method Summary collapse
- #csv_opts ⇒ Object
-
#initialize(path) ⇒ CsvFormatGuesser
constructor
A new instance of CsvFormatGuesser.
Constructor Details
#initialize(path) ⇒ CsvFormatGuesser
Returns a new instance of CsvFormatGuesser.
11 12 13 14 15 16 |
# File 'lib/csv_format_guesser.rb', line 11 def initialize(path) @path = path guess_encoding() guess_col_sep() guess_quote_char() end |
Instance Attribute Details
#col_sep ⇒ Object (readonly)
Returns the value of attribute col_sep.
3 4 5 |
# File 'lib/csv_format_guesser.rb', line 3 def col_sep @col_sep end |
#encoding ⇒ Object (readonly)
Returns the value of attribute encoding.
3 4 5 |
# File 'lib/csv_format_guesser.rb', line 3 def encoding @encoding end |
#quote_char ⇒ Object (readonly)
Returns the value of attribute quote_char.
3 4 5 |
# File 'lib/csv_format_guesser.rb', line 3 def quote_char @quote_char end |
Instance Method Details
#csv_opts ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/csv_format_guesser.rb', line 18 def csv_opts { encoding: @encoding, col_sep: @col_sep, quote_char: @quote_char, } end |