Module: BigQuery::Attribute

Defined in:
lib/bigquery-client/attribute.rb,
lib/bigquery-client/attribute/base.rb,
lib/bigquery-client/attribute/float.rb,
lib/bigquery-client/attribute/string.rb,
lib/bigquery-client/attribute/boolean.rb,
lib/bigquery-client/attribute/integer.rb,
lib/bigquery-client/attribute/timestamp.rb

Defined Under Namespace

Classes: Base, Boolean, Float, Integer, String, Timestamp, UnknownType

Class Method Summary collapse

Class Method Details

.new(name: nil, type: nil, value: nil) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/bigquery-client/attribute.rb', line 6

def self.new(name: nil, type: nil, value: nil)
  class_name = (type[0] || '').upcase + (type[1..-1] || '').downcase
  if klass = BigQuery::Attribute.const_get(class_name)
    klass.new(name, value)
  else
    fail UnknownType, "unknown type: #{type}"
  end
end