Class: Innodb::DataType::CharacterType
- Inherits:
-
Object
- Object
- Innodb::DataType::CharacterType
- Defined in:
- lib/innodb/data_type.rb
Overview
Fixed-length character type.
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) ⇒ CharacterType
constructor
A new instance of CharacterType.
- #value(data) ⇒ Object
Constructor Details
#initialize(base_type, modifiers, properties) ⇒ CharacterType
Returns a new instance of CharacterType.
180 181 182 183 |
# File 'lib/innodb/data_type.rb', line 180 def initialize(base_type, modifiers, properties) @width = modifiers.fetch(0, 1) @name = Innodb::DataType.make_name(base_type, modifiers, properties) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
178 179 180 |
# File 'lib/innodb/data_type.rb', line 178 def name @name end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
178 179 180 |
# File 'lib/innodb/data_type.rb', line 178 def width @width end |
Instance Method Details
#value(data) ⇒ Object
185 186 187 188 189 |
# File 'lib/innodb/data_type.rb', line 185 def value(data) # The SQL standard defines that CHAR fields should have end-spaces # stripped off. data.sub(/[ ]+$/, "") end |