Class: SqlPostgres::PgType

Inherits:
Object
  • Object
show all
Defined in:
lib/sqlpostgres/PgType.rb

Overview

This is the base class for the classes that represent column types.

Instance Method Summary collapse

Instance Method Details

#eql?(other) ⇒ Boolean Also known as: ==

Return true if other is is equal to this object.

Returns:

  • (Boolean)


9
10
11
# File 'lib/sqlpostgres/PgType.rb', line 9

def eql?(other)
  other.is_a?(self.class) && parts == other.parts
end

#hashObject

Return the hash code.



16
17
18
# File 'lib/sqlpostgres/PgType.rb', line 16

def hash
  parts.to_s.hash
end

#to_sqlObject

Return the SQL representation.



22
23
24
# File 'lib/sqlpostgres/PgType.rb', line 22

def to_sql
  "#{column_type} '#{to_s}'"
end