module Thrift::Struct

Public Instance Methods

to_hash() click to toggle source
# File lib/thrift_client/thrift/struct.rb, line 3
def to_hash
  hash = {}
  each_field do |fid, field_info|
    name = field_info[:name]
    value = instance_variable_get("@#{name}")
    unless field_info[:optional] && value.nil?
      hash.store(name, value)
    end
  end
  return hash
end