Class: Perpetuity::Postgres::TableName

Inherits:
Object
  • Object
show all
Defined in:
lib/perpetuity/postgres/table_name.rb

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ TableName

Returns a new instance of TableName.

Raises:



5
6
7
8
# File 'lib/perpetuity/postgres/table_name.rb', line 5

def initialize name
  @name = name.to_s
  raise InvalidTableName, "PostgreSQL table name cannot contain double quotes" if @name.include? '"'
end

Instance Method Details

#==(other) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/perpetuity/postgres/table_name.rb', line 14

def == other
  if other.is_a? String
    other == @name
  else
    to_s == other.to_s
  end
end

#to_sObject



10
11
12
# File 'lib/perpetuity/postgres/table_name.rb', line 10

def to_s
  @name.to_s.inspect
end