Class: ActiveRecord::ConnectionAdapters::SunstoneColumn

Inherits:
Column
  • Object
show all
Defined in:
lib/active_record/connection_adapters/sunstone/column.rb

Overview

Sunstone-specific extensions to column definitions in a table.

Constant Summary collapse

NONE =

:nodoc:

Object.new

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, sql_type_metadata, options = {}) ⇒ SunstoneColumn

Returns a new instance of SunstoneColumn.



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/active_record/connection_adapters/sunstone/column.rb', line 9

def initialize(name, , options={})
  @name = name.freeze
  @sql_type_metadata = 
  @null = options['null']
  @default = options['default'] ? JSON.generate(options['default']) : options['default']
  @default_function = nil
  @collation = nil
  @table_name = nil
  @primary_key = (options['primary_key'] == true)
  @array = options['array']
  @auto_populated = options.has_key?('auto_populated') ? options['auto_populated'] : NONE
end

Instance Attribute Details

#arrayObject (readonly)

Returns the value of attribute array.



7
8
9
# File 'lib/active_record/connection_adapters/sunstone/column.rb', line 7

def array
  @array
end

Instance Method Details

#auto_populated?Boolean

Returns:

  • (Boolean)


26
27
28
29
30
31
# File 'lib/active_record/connection_adapters/sunstone/column.rb', line 26

def auto_populated?
  # TODO: when retuning is working we can do the following to only
  # return autopulated fields from StandardAPI
  # @auto_populated == NONE ? @primary_key : @auto_populated
  true
end

#primary_key?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/active_record/connection_adapters/sunstone/column.rb', line 22

def primary_key?
  @primary_key
end