Class: CsvSeparatorDetector
- Inherits:
-
Object
- Object
- CsvSeparatorDetector
- Defined in:
- lib/csv_separator_detector.rb,
lib/csv_separator_detector/version.rb
Defined Under Namespace
Classes: Error
Constant Summary collapse
- VERSION =
"0.1.0"
Instance Attribute Summary collapse
-
#csv_text ⇒ Object
readonly
Returns the value of attribute csv_text.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(csv_text) ⇒ CsvSeparatorDetector
constructor
A new instance of CsvSeparatorDetector.
- #supported_separators ⇒ Object
Constructor Details
#initialize(csv_text) ⇒ CsvSeparatorDetector
Returns a new instance of CsvSeparatorDetector.
10 11 12 |
# File 'lib/csv_separator_detector.rb', line 10 def initialize(csv_text) @csv_text = csv_text end |
Instance Attribute Details
#csv_text ⇒ Object (readonly)
Returns the value of attribute csv_text.
8 9 10 |
# File 'lib/csv_separator_detector.rb', line 8 def csv_text @csv_text end |
Instance Method Details
#call ⇒ Object
14 15 16 |
# File 'lib/csv_separator_detector.rb', line 14 def call separator_with_most_columns or fail CsvSeparatorDetector::Error end |
#supported_separators ⇒ Object
18 19 20 |
# File 'lib/csv_separator_detector.rb', line 18 def supported_separators [',', ';', "\t", '|'] end |