module Aws::Lex::Conversation::Type::Base::InstanceMethods
Public Instance Methods
assign_attributes!(opts = {})
click to toggle source
# File lib/aws/lex/conversation/type/base.rb, line 21 def assign_attributes!(opts = {}) attributes = self.class.attributes | self.class.virtual_attributes attributes.each do |attribute| instance_variable_set("@#{attribute}", opts[attribute]) end end
to_lex()
click to toggle source
# File lib/aws/lex/conversation/type/base.rb, line 28 def to_lex output = self.class.attributes.each_with_object({}) do |attribute, hash| value = transform_to_lex(public_send(attribute)) hash[self.class.mapping.fetch(attribute)] = value end output.compact end
Private Instance Methods
transform_to_lex(value)
click to toggle source
# File lib/aws/lex/conversation/type/base.rb, line 38 def transform_to_lex(value) case value when Hash if value.respond_to?(:to_lex) value.to_lex else output = value.each_with_object({}) do |(key, val), hash| hash[key.to_sym] = transform_to_lex(val) end output.compact end when Array value.map { |v| transform_to_lex(v) } else if value.respond_to?(:to_lex) value.to_lex else value end end end