Class: GoogleFT::Table::Column

Inherits:
Object
  • Object
show all
Defined in:
lib/google-ft/table/column.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#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

Instance Attribute Details

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/google-ft/table/column.rb', line 4

def name
  @name
end

#typeObject

Returns the value of attribute type.



4
5
6
# File 'lib/google-ft/table/column.rb', line 4

def type
  @type
end