Class: Hecks::Domain::Adapters::SQLDatabase::Commands::Update::DeleteReferences

Inherits:
Object
  • Object
show all
Defined in:
lib/adapters/sql_database/commands/update/delete_references.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table:, attributes:, reference:) ⇒ DeleteReferences

Returns a new instance of DeleteReferences.



10
11
12
13
14
15
16
# File 'lib/adapters/sql_database/commands/update/delete_references.rb', line 10

def initialize(table:, attributes:, reference:)
  @table = table
  @attributes = attributes
  @reference = reference
  @where_clause = {}
  @dataset = DB[JoinTable.new(@table, @reference).name.to_sym]
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



8
9
10
# File 'lib/adapters/sql_database/commands/update/delete_references.rb', line 8

def attributes
  @attributes
end

Instance Method Details

#callObject



18
19
20
21
22
23
# File 'lib/adapters/sql_database/commands/update/delete_references.rb', line 18

def call
  build_where_clause
  delete_references
  remove_references_from_attributes
  self
end