class Embulk::Input::GoogleSpreadsheets::Typecast::Base

Attributes

null_string[R]

Public Class Methods

new(task) click to toggle source
# File lib/embulk/input/google_spreadsheets/typecast/base.rb, line 9
def initialize(task)
  @null_string = task['null_string']
end

Public Instance Methods

as_boolean(value) click to toggle source
# File lib/embulk/input/google_spreadsheets/typecast/base.rb, line 39
def as_boolean(value)
  raise NotImplementedError, '`embulk-input-google_spreadsheets`: override this.'
end
as_double(value) click to toggle source
# File lib/embulk/input/google_spreadsheets/typecast/base.rb, line 35
def as_double(value)
  raise NotImplementedError, '`embulk-input-google_spreadsheets`: override this.'
end
as_json(value) click to toggle source
# File lib/embulk/input/google_spreadsheets/typecast/base.rb, line 47
def as_json(value)
  raise NotImplementedError, '`embulk-input-google_spreadsheets`: override this.'
end
as_long(value) click to toggle source
# File lib/embulk/input/google_spreadsheets/typecast/base.rb, line 31
def as_long(value)
  raise NotImplementedError, '`embulk-input-google_spreadsheets`: override this.'
end
as_string(value) click to toggle source
# File lib/embulk/input/google_spreadsheets/typecast/base.rb, line 27
def as_string(value)
  raise NotImplementedError, '`embulk-input-google_spreadsheets`: override this.'
end
as_timestamp(value, timestamp_format, timezone) click to toggle source
# File lib/embulk/input/google_spreadsheets/typecast/base.rb, line 43
def as_timestamp(value, timestamp_format, timezone)
  raise NotImplementedError, '`embulk-input-google_spreadsheets`: override this.'
end
logger() click to toggle source
# File lib/embulk/input/google_spreadsheets/typecast/base.rb, line 13
def logger
  GoogleSpreadsheets.logger
end
to_json(*args) click to toggle source
# File lib/embulk/input/google_spreadsheets/typecast/base.rb, line 17
def to_json(*args) # for logging
  spec = {JSON.create_id => self.class.name}
  spec = instance_variables.inject(spec) do |spec, v|
    spec.tap do |s|
      s[v] = instance_variable_get(v)
    end
  end
  spec.to_json(*args)
end

Protected Instance Methods

null_string?(value) click to toggle source
# File lib/embulk/input/google_spreadsheets/typecast/base.rb, line 53
def null_string?(value)
  return false unless value.is_a?(String)
  return true if value == null_string
  return false
end