Sha256: 886695e94d7a32283cf0b803f5e8dd771181761c3cf3ad89a69fffc21fc633b5

Contents?: true

Size: 714 Bytes

Versions: 6

Compression:

Stored size: 714 Bytes

Contents

# frozen_string_literal: true
require "forwardable"

module HTTP
  class Headers
    # Provides shared behavior for {HTTP::Request} and {HTTP::Response}.
    # Expects `@headers` to be an instance of {HTTP::Headers}.
    #
    # @example Usage
    #
    #   class MyHttpRequest
    #     include HTTP::Headers::Mixin
    #
    #     def initialize
    #       @headers = HTTP::Headers.new
    #     end
    #   end
    module Mixin
      extend Forwardable

      # @return [HTTP::Headers]
      attr_reader :headers

      # @!method []
      #   (see HTTP::Headers#[])
      def_delegator :headers, :[]

      # @!method []=
      #   (see HTTP::Headers#[]=)
      def_delegator :headers, :[]=
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
http-2.2.2 lib/http/headers/mixin.rb
http-2.2.1 lib/http/headers/mixin.rb
http-2.2.0 lib/http/headers/mixin.rb
http-2.1.0 lib/http/headers/mixin.rb
http-2.0.3 lib/http/headers/mixin.rb
http-2.0.2 lib/http/headers/mixin.rb