File: response_fragment.rb

package info (click to toggle)
ruby-httparty 0.24.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 964 kB
  • sloc: ruby: 7,521; xml: 425; sh: 35; makefile: 14
file content (21 lines) | stat: -rw-r--r-- 467 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

require 'delegate'

module HTTParty
  # Allow access to http_response and code by delegation on fragment
  class ResponseFragment < SimpleDelegator
    attr_reader :http_response, :connection

    def code
      @http_response.code.to_i
    end

    def initialize(fragment, http_response, connection)
      @fragment = fragment
      @http_response = http_response
      @connection = connection
      super fragment
    end
  end
end