You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: generic_object.rb
    path of file: ./repos/artichoke/artichoke-backend/src/extn/stdlib/json/vendor/json
    
    the code of the file until where you have to start completion: # frozen_string_literal: false

require 'ostruct'

module JSON
  cla
    
      def from_hash(object)
        if object.respond_to?(:to_hash)
          result = new
          object.to_hash.each do |key, value|
            result[key] = from_hash(value)
          end
          result
        elsif object.respond_to?(:to_ary)
          object.to_ary.map { |a| from_hash(a) }
        else
          object
        end