# File lib/yajl.rb, line 61
    def self.encode(obj, *args, &block)
      # TODO: this code smells, any ideas?
      args.flatten!
      options = {}
      io = nil
      args.each do |arg|
        if arg.is_a?(Hash)
          options = arg
        elsif arg.respond_to?(:read)
          io = arg
        end
      end if args.any?
      new(options).encode(obj, io, &block)
    end