Class: DB::MariaDB::Native::Types::Boolean

Inherits:
Object
  • Object
show all
Defined in:
lib/db/mariadb/native/types.rb

Overview

A boolean type converter.

Instance Method Summary collapse

Instance Method Details

#nameObject

Get the SQL type name for boolean.



56
57
58
# File 'lib/db/mariadb/native/types.rb', line 56

def name
	"BOOLEAN"
end

#parse(string) ⇒ Object

Parse a boolean value from the database.



63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/db/mariadb/native/types.rb', line 63

def parse(string)
	case string
	when "0"
		false
	when "1"
		true
	when nil
		nil
	else
		Integer(string)
	end
end