Class: ActiveRecord::ConnectionAdapters::IBM_DB2Column

Inherits:
Column
  • Object
show all
Defined in:
lib/connection_adapters/ibm_db2_adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, default, generated, sql_type = nil, null = true) ⇒ IBM_DB2Column

Returns a new instance of IBM_DB2Column.



111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/connection_adapters/ibm_db2_adapter.rb', line 111

def initialize(name, default, generated, sql_type = nil, null = true)
  @name, @type, @null = name, simplified_type(sql_type), null
  @text  = [:string, :text, :binary].include? @type
  @sql_type = sql_type
  # have to do this one separately because type_cast depends on #type
  if !(default.nil? || default.blank?) then @default_specified = true end
  @default = type_cast(default)
  # Extracts the limit if it's a :string or :text type
  @limit   = extract_limit(sql_type) if !sql_type.nil? && @text
  @primary = nil
  @number  = [:float, :integer].include? @type
  @generated = generated
end

Instance Attribute Details

#default_specifiedObject

Returns the value of attribute default_specified.



109
110
111
# File 'lib/connection_adapters/ibm_db2_adapter.rb', line 109

def default_specified
  @default_specified
end

#generatedObject

Returns the value of attribute generated.



109
110
111
# File 'lib/connection_adapters/ibm_db2_adapter.rb', line 109

def generated
  @generated
end

Instance Method Details

#default_specified?Boolean

Returns:

  • (Boolean)


125
126
127
# File 'lib/connection_adapters/ibm_db2_adapter.rb', line 125

def default_specified?
  @default_specified
end

#generated?Boolean

Returns:

  • (Boolean)


129
130
131
# File 'lib/connection_adapters/ibm_db2_adapter.rb', line 129

def generated?
  !(generated.nil? || generated.blank?)
end