Module: Embulk::Input::GoogleSpreadsheets::TypecastFactory

Defined in:
lib/embulk/input/google_spreadsheets/typecast_factory.rb

Class Method Summary collapse

Class Method Details

.create(type, task) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/embulk/input/google_spreadsheets/typecast_factory.rb', line 7

def self.create(type, task)
  raise GoogleSpreadsheets::ConfigError.new("`embulk-input-google_spreadsheets`: unknown typecast '#{type}'") if type.nil? or !type.is_a?(String)

  type = type.downcase
  path = build_typecast_class_path(type)
  raise GoogleSpreadsheets::ConfigError.new("`embulk-input-google_spreadsheets`: Typecast class path does not exist '#{path}'") unless File.exist?(path)

  require path
  typecast_class(type).new(task)
end