Class: Commutator::Options::GetItem

Inherits:
Object
  • Object
show all
Includes:
Util::Fluent
Defined in:
lib/commutator/options/get_item.rb

Instance Method Summary collapse

Constructor Details

#initializeGetItem

Returns a new instance of GetItem.



17
18
19
20
21
22
23
24
# File 'lib/commutator/options/get_item.rb', line 17

def initialize
  @key = {}

  @expression_attribute_names = Expressions::AttributeNames.new

  @projection_expression = Expressions::ProjectionExpression.new(
    attribute_names: @expression_attribute_names)
end

Instance Method Details

#to_hObject Also known as: to_hash



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/commutator/options/get_item.rb', line 26

def to_h
  hash = {
    table_name: table_name,
    expression_attribute_names: expression_attribute_names.to_h,
    consistent_read: consistent_read,
    return_consumed_capacity: return_consumed_capacity,
    projection_expression: projection_expression.to_s,
    key: key
  }

  hash.keep_if { |_key, value| value.present? || value == false }
end