module PrestoLegacy::Client::Models::WriterTarget

Public Class Methods

decode(hash) click to toggle source
# File lib/presto_legacy/client/models.rb, line 172
def decode(hash)
  unless hash.is_a?(Hash)
    raise TypeError, "Can't convert #{hash.class} to Hash"
  end
  obj = allocate
  model_class = case hash["@type"]
      when "CreateHandle"       then OutputTableHandle
      when "InsertHandle"       then InsertTableHandle
      when "DeleteHandle"       then TableHandle
  end
  obj.send(:initialize_struct,
    hash["@type"],
    model_class.decode(hash['handle'])
  )
  obj
end