class Dynorm::KeyExpression
Public Class Methods
new(attributes)
click to toggle source
# File lib/dynorm/key_expression.rb, line 5 def initialize(attributes) @attributes = attributes end
Public Instance Methods
attribute_names()
click to toggle source
# File lib/dynorm/key_expression.rb, line 9 def attribute_names @attributes.keys.each_with_object({}) do |value, hash| hash["##{value}_name"] = value end end
attribute_values()
click to toggle source
# File lib/dynorm/key_expression.rb, line 15 def attribute_values @attributes.keys.each_with_object({}) do |value, hash| hash[":#{value}_value"] = @attributes[value] end end
key_condition_expression()
click to toggle source
# File lib/dynorm/key_expression.rb, line 21 def key_condition_expression @attributes.map do |attr| "##{attr[0]}_name = :#{attr[0]}_value" end.join(' and ') end
params()
click to toggle source
# File lib/dynorm/key_expression.rb, line 27 def params { expression_attribute_names: attribute_names, expression_attribute_values: attribute_values, key_condition_expression: key_condition_expression } end