Convert the options to aggregation pipeline friendly options.

 @example Convert the options to a pipeline.
   options.to_pipeline

 @return [ Array<Hash> ] The options in pipeline form.

 @since 2.0.0
773073
def to_pipeline
      pipeline = []
      pipeline.push({ "$skip" => skip }) if skip
      pipeline.push({ "$limit" => limit }) if limit
      pipeline.push({ "$sort" => sort }) if sort
      pipeline
    end
924094
def convert(answer)
      case answer
      when Hash
        convert_hash(answer)
      when Array
        convert_array(answer)
      else
        answer
      end
    end
968855
def convert_to_hash(data)
      data.map do |item|
        item[:key].split('/').reverse.reduce(item[:value]) { |h, v| { v => h } }
      end.reduce(:deep_merge)
    end
1278240
def _process_options(options)
        super
        if options[:stream]
          if request.version == "HTTP/1.0"
            options.delete(:stream)
          else
            headers["Cache-Control"] ||= "no-cache"
            headers["Transfer-Encoding"] = "chunked"
            headers.delete("Content-Length")
          end
        end
      end
707796
def to_hash
      Hash.new.tap do |hash|
        @child_options.each do |name, opt|
          # this is meant to be a "value exporter", so always use distinct values
          # on the returned hash to prevent unintentional pass-by-ref shared objects
          hash[name.to_sym] = NsOptions.distinct_value(opt.value)
        end
        @child_namespaces.each{|name, value| hash[name.to_sym] = value.to_hash}
      end
    end
1233898
def to_hash(args = {}) # :nodoc:
      args ||= {}
      hash = {}

      self.attributes.each do |name, value|
        hash[name] = if value.is_a?(::Array)
          value.map {|x| x.respond_to?(:to_hash) ? call_method_with_optional_parameters(x, :to_hash, :nested => true) : x}
        elsif value.respond_to?(:to_hash)
          call_method_with_optional_parameters(value, :to_hash, :nested => true)
        elsif value.respond_to?(:as_json)
          value.as_json(:nested => true)
        else
          value
        end
      end

      hash
    end
179159
def options
      hash = {}
      hash[:p] = ENV["FASTLANE_PATH"] if ENV["FASTLANE_PATH"]
      hash[:P] = ENV["FASTLANE_PORT"] if ENV["FASTLANE_PORT"]
      hash[:r] = ENV["FASTLANE_PROTOCOL"] if ENV["FASTLANE_PROTOCOL"]
      hash.empty? ? nil : hash
    end
307797
def normalize_options(options)
      case options
      when Hash
        Hash[options.map{|k,v| [k.respond_to?(:to_sym) ? k.to_sym : k, v]}].tap do |opts|
          opts[:driver] = opts[:driver].to_s if opts[:driver]
        end
      when String, URI
        parse_connection_uri(options)
      else
        raise RDO::Exception,
          "Unsupported connection argument format: #{options.class.name}"
      end
    end
1329526
def ! options = {}
      merged_options = merge_headers_and_queries options
      unless @stubbed
        self.class.send(@method, @path || '/', merged_options)
      else
        uri = "#{self.class.base_uri}#{@path}"

        stub_request(@method.to_sym, uri.to_s).with merged_options
      end
    end
858266
def options
      VALID_OPTIONS.inject({}) do |option, key|
        option.merge!(key => send(key))
      end
    end
125047
def to_hash
      Hash[options.reject(&:null?).map { |o| [o.key, o.value] }]
    end
258566
def options
      options = {}
      VALID_OPTION_KEYS.each{|k| options[k] = send(k)}
      options
    end
30184
def to_a
      if @order == :ascending
        @data.sort { |a, b| a[@sort_by] <=> b[@sort_by] }
      else
        @data.sort { |a, b| b[@sort_by] <=> a[@sort_by] }
      end
    end
681837
def to_hash
      result = {}
      @lines.entries.each do |section|
        result[section.key] ||= {}
        section.entries.each do |option|
          opts = Array(option)
          val = opts.map { |o| o.respond_to?(:value) ? o.value : o }
          val = val.size > 1 ? val : val.first
          result[section.key][opts.first.key] = val
        end
      end
      result
    end
938632
def to_csv(options={})
      CSV.generate(options) do |csv|
        csv << scope.attributes
        csv << attributes_hash.values
      end
    end
1311446
def serializable_hash
      return serializable_collection if collection?
      self.class._attributes.each_with_object({}) do |(name, option), hash|
        if _include_from_options?(name) && public_send(option[:include_method])
          hash[option[:key] || name] = _set_value(name, option)
        end
      end
    end
120179
def extract_options!(array)
      if array.last.is_a?(Hash) && array.last.instance_of?(Hash)
        array.pop
      else
        {}
      end
    end