Class: DB::Postgres::Native::Types::Float

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

Overview

A floating point type converter.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = "FLOAT") ⇒ Float

Initialize a float type converter.



88
89
90
# File 'lib/db/postgres/native/types.rb', line 88

def initialize(name = "FLOAT")
	@name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



93
94
95
# File 'lib/db/postgres/native/types.rb', line 93

def name
  @name
end

#The SQL type name.(SQLtypename.) ⇒ Object (readonly)



93
# File 'lib/db/postgres/native/types.rb', line 93

attr :name

Instance Method Details

#parse(string) ⇒ Object

Parse a float value from the database.



98
99
100
# File 'lib/db/postgres/native/types.rb', line 98

def parse(string)
	Float(string) if string
end