class Field
A field (column) in a result set with metadata and type information.
Definitions
def boolean?
Check if this field represents a boolean type.
Signature
-
returns
Boolean True if the field is a boolean.
Implementation
def boolean?
self[:length] == 1 && (self[:type] == :tiny || self[:type] == :long)
end
def name
Get the field name.
Signature
-
returns
String The field name.
Implementation
def name
self[:name]
end
def type
Get the field type, with boolean detection.
Signature
-
returns
Symbol The field type.
Implementation
def type
if boolean?
:boolean
else
self[:type]
end
end
def inspect
Generate a string representation of the field.
Signature
-
returns
String A human-readable representation.
Implementation
def inspect
"\#<#{self.class} name=#{self.name} type=#{self.type} length=#{self[:length]}>"
end