Class: Innodb::DataType::VariableCharacterType
- Inherits:
-
Object
- Object
- Innodb::DataType::VariableCharacterType
- Defined in:
- lib/innodb/data_type.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(base_type, modifiers, properties) ⇒ VariableCharacterType
constructor
A new instance of VariableCharacterType.
- #value(data) ⇒ Object
Constructor Details
#initialize(base_type, modifiers, properties) ⇒ VariableCharacterType
Returns a new instance of VariableCharacterType.
207 208 209 210 211 212 |
# File 'lib/innodb/data_type.rb', line 207 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
#name ⇒ Object (readonly)
Returns the value of attribute name.
204 205 206 |
# File 'lib/innodb/data_type.rb', line 204 def name @name end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
205 206 207 |
# File 'lib/innodb/data_type.rb', line 205 def width @width end |
Instance Method Details
#value(data) ⇒ Object
214 215 216 217 218 |
# File 'lib/innodb/data_type.rb', line 214 def value(data) # The SQL standard defines that VARCHAR fields should have end-spaces # stripped off. data.sub(/ +$/, "") end |