Module: Fluent::BigQuery::Storage::Helper

Defined in:
lib/fluent/plugin/bigquery/storage/helper.rb

Class Method Summary collapse

Class Method Details

.get_descriptor_data(file_path) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/fluent/plugin/bigquery/storage/helper.rb', line 11

def get_descriptor_data(file_path)
  File.foreach(file_path) do |line|
    if line.start_with?("descriptor_data = ")
      data = line.chomp.gsub(/^descriptor_data = /, '')
      return eval(data)
    end
  end

  raise "No descriptor data found in file. path=#{file_path}"
end

.snake_to_pascal(snake_case) ⇒ Object



6
7
8
9
# File 'lib/fluent/plugin/bigquery/storage/helper.rb', line 6

def snake_to_pascal(snake_case)
  words = snake_case.split('_')
  words.map(&:capitalize).join
end