Method: GoogleFT::Table::Column#initialize

Defined in:
lib/google-ft/table/column.rb

#initialize(name, type = 'string') ⇒ Column

Returns a new instance of Column.

Raises:

  • (ArgumentError)


6
7
8
9
10
11
12
13
# File 'lib/google-ft/table/column.rb', line 6

def initialize(name, type = 'string')
  # Cleanup the column name.
  self.name = name.gsub(/[^a-zA-Z0-9_\-]/, '_')

  # Store type and make sure it's valid.
  self.type = type.upcase
  raise ArgumentError unless ['STRING','NUMBER','DATETIME','LOCATION'].include?(self.type)
end