Class: Csv2Psql::Analyzers::Time
- Inherits:
-
BaseAnalyzer
- Object
- BaseAnalyzer
- Csv2Psql::Analyzers::Time
- Defined in:
- lib/csv2psql/analyzer/types/time.rb
Overview
Bigint value matcher
Constant Summary collapse
- TYPE =
:time- CLASS =
:date- WEIGHT =
3- RE =
Regexp.new(/^[0-9]{2}:[0-9]{2}(:[0-9]{2})?$/)
Class Method Summary collapse
Methods inherited from BaseAnalyzer
#analyze, #convert, #numeric?, numeric?, #sql_class, sql_class, sql_class?, #sql_class?, sql_type, #sql_type, sql_type?, #sql_type?, weight, #weight
Class Method Details
.analyze(val) ⇒ Object
16 17 18 |
# File 'lib/csv2psql/analyzer/types/time.rb', line 16 def analyze(val) val && RE.match(val) end |
.convert(val) ⇒ Object
20 21 22 |
# File 'lib/csv2psql/analyzer/types/time.rb', line 20 def convert(val) val.to_i end |