Module: Embulk::Input::JiraInputPluginUtils

Defined in:
lib/embulk/input/jira_input_plugin_utils.rb

Class Method Summary collapse

Class Method Details

.cast(value, type) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/embulk/input/jira_input_plugin_utils.rb', line 40

def self.cast(value, type)
  return value if value.nil?

  case type.to_sym
  when :long
    Integer(value)
  when :double
    Float(value)
  when :timestamp
    Time.parse(value)
  when :boolean
    !!value
  else
    value.to_s
  end
end

.guess_columns(records) ⇒ Object

Guess::SchemaGuess.from_hash_records returns Columns containing ‘index’ key, but it is needless.



30
31
32
33
34
35
36
37
38
# File 'lib/embulk/input/jira_input_plugin_utils.rb', line 30

def self.guess_columns(records)
  schema = Guess::SchemaGuess.from_hash_records(records)

  schema.map do |c|
    column = {name: c.name, type: c.type}
    column[:format] = c.format if c.format
    column
  end
end