Class: Simple::SQL::Connection::Duplicator

Inherits:
Object
  • Object
show all
Defined in:
lib/simple/sql/connection/duplicate.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection, table_name, overrides) ⇒ Duplicator

Returns a new instance of Duplicator.



26
27
28
29
30
# File 'lib/simple/sql/connection/duplicate.rb', line 26

def initialize(connection, table_name, overrides)
  @connection       = connection
  @table_name       = table_name
  @custom_overrides = validated_overrides(overrides)
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



22
23
24
# File 'lib/simple/sql/connection/duplicate.rb', line 22

def connection
  @connection
end

#custom_overridesObject (readonly)

Returns the value of attribute custom_overrides.



24
25
26
# File 'lib/simple/sql/connection/duplicate.rb', line 24

def custom_overrides
  @custom_overrides
end

#table_nameObject (readonly)

Returns the value of attribute table_name.



23
24
25
# File 'lib/simple/sql/connection/duplicate.rb', line 23

def table_name
  @table_name
end

Instance Method Details

#call(ids) ⇒ Object



32
33
34
35
36
# File 'lib/simple/sql/connection/duplicate.rb', line 32

def call(ids)
  connection.all query, ids
rescue PG::UndefinedColumn => e
  raise ArgumentError, e.message
end