Class: Innodb::DataType::VariableCharacterType

Inherits:
Object
  • Object
show all
Defined in:
lib/innodb/data_type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_type, modifiers, properties) ⇒ VariableCharacterType

Returns a new instance of VariableCharacterType.



196
197
198
199
200
# File 'lib/innodb/data_type.rb', line 196

def initialize(base_type, modifiers, properties)
  @width = modifiers[0]
  raise "Invalid width specification" unless modifiers.size == 1
  @name = Innodb::DataType.make_name(base_type, modifiers, properties)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



194
195
196
# File 'lib/innodb/data_type.rb', line 194

def name
  @name
end

#widthObject (readonly)

Returns the value of attribute width.



194
195
196
# File 'lib/innodb/data_type.rb', line 194

def width
  @width
end

Instance Method Details

#value(data) ⇒ Object



202
203
204
205
206
# File 'lib/innodb/data_type.rb', line 202

def value(data)
  # The SQL standard defines that VARCHAR fields should have end-spaces
  # stripped off.
  data.sub(/[ ]+$/, "")
end