Class: Commutator::Options::Scan

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

Instance Method Summary collapse

Constructor Details

#initializeScan

Returns a new instance of Scan.



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

def initialize
  @expression_attribute_values = Expressions::AttributeValues.new
  @expression_attribute_names = Expressions::AttributeNames.new

  @filter_expression = Expressions::ConditionExpression.new(
    attribute_names: @expression_attribute_names,
    attribute_values: @expression_attribute_values)

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

Instance Method Details

#to_hObject Also known as: to_hash



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/commutator/options/scan.rb', line 38

def to_h
  hash = {
    projection_expression: projection_expression.to_s,
    expression_attribute_values: expression_attribute_values.to_h,
    expression_attribute_names: expression_attribute_names.to_h,
    filter_expression: filter_expression.to_s(wrap: false),
    consistent_read: consistent_read,
    exclusive_start_key: exclusive_start_key,
    index_name: index_name,
    limit: limit,
    select: select,
    return_consumed_capacity: return_consumed_capacity,
    table_name: table_name,
    total_segments: total_segments,
    segment: segment
  }

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