Class: GemChangelogDiff::CachedResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/gem_changelog_diff/cache.rb

Overview

Lightweight stand-in for Net::HTTPResponse built from cached data.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body, code) ⇒ CachedResponse

Returns a new instance of CachedResponse.



120
121
122
123
# File 'lib/gem_changelog_diff/cache.rb', line 120

def initialize(body, code)
  @body = body
  @code = code
end

Instance Attribute Details

#bodyString (readonly)

Returns:

  • (String)

    the response body

  • (String)

    the HTTP status code



118
119
120
# File 'lib/gem_changelog_diff/cache.rb', line 118

def body
  @body
end

#codeString (readonly)

Returns:

  • (String)

    the response body

  • (String)

    the HTTP status code



118
119
120
# File 'lib/gem_changelog_diff/cache.rb', line 118

def code
  @code
end

Instance Method Details

#[](_header) ⇒ Object



131
132
133
# File 'lib/gem_changelog_diff/cache.rb', line 131

def [](_header)
  nil
end

#is_a?(klass) ⇒ Boolean

Returns:

  • (Boolean)


125
126
127
128
129
# File 'lib/gem_changelog_diff/cache.rb', line 125

def is_a?(klass)
  return true if klass == Net::HTTPSuccess && @code.start_with?("2")

  super
end