Class: Hecks::Adapters::SQLDatabase::Commands::Update

Inherits:
Object
  • Object
show all
Defined in:
lib/commands/update.rb,
lib/commands/update/update_values.rb,
lib/commands/update/create_new_value.rb,
lib/commands/update/delete_references.rb,
lib/commands/update/link_to_references.rb

Defined Under Namespace

Classes: CreateNewValue, DeleteReferences, LinkToReferences, UpdateValues

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes:, head:, id:) ⇒ Update

Returns a new instance of Update.



13
14
15
16
17
18
# File 'lib/commands/update.rb', line 13

def initialize(attributes:, head:, id:)
  @attributes = attributes.clone
  @references = head.references
  @head_table = Table.factory([head]).first
  @id = id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



11
12
13
# File 'lib/commands/update.rb', line 11

def id
  @id
end

Instance Method Details

#callObject



20
21
22
23
24
25
26
27
# File 'lib/commands/update.rb', line 20

def call
  DB.transaction do
    update_references
    fetch_record
    update_record
  end
  self
end