Class: Dynamoid::TransactionWrite::Create

Inherits:
Base
  • Object
show all
Defined in:
lib/dynamoid/transaction_write/create.rb

Instance Method Summary collapse

Constructor Details

#initialize(model_class, attributes = {}, **options, &block) ⇒ Create

Returns a new instance of Create.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/dynamoid/transaction_write/create.rb', line 8

def initialize(model_class, attributes = {}, **options, &block)
  super()

  @model = model_class.new(attributes)

  if block
    yield(@model)
  end

  @save_action = Save.new(@model, **options)
end

Instance Method Details

#aborted?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/dynamoid/transaction_write/create.rb', line 32

def aborted?
  @save_action.aborted?
end

#action_requestObject



44
45
46
# File 'lib/dynamoid/transaction_write/create.rb', line 44

def action_request
  @save_action.action_request
end

#observable_by_user_resultObject



40
41
42
# File 'lib/dynamoid/transaction_write/create.rb', line 40

def observable_by_user_result
  @model
end

#on_commitObject



24
25
26
# File 'lib/dynamoid/transaction_write/create.rb', line 24

def on_commit
  @save_action.on_commit
end

#on_registrationObject



20
21
22
# File 'lib/dynamoid/transaction_write/create.rb', line 20

def on_registration
  @save_action.on_registration
end

#on_rollbackObject



28
29
30
# File 'lib/dynamoid/transaction_write/create.rb', line 28

def on_rollback
  @save_action.on_rollback
end

#skipped?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/dynamoid/transaction_write/create.rb', line 36

def skipped?
  false
end