Module: Docs::Response

Defined in:
lib/docs/core/response.rb

Instance Method Summary collapse

Instance Method Details

#effective_pathObject


31
32
33
# File 'lib/docs/core/response.rb', line 31

def effective_path
  @effective_path ||= effective_url.path
end

#effective_urlObject


27
28
29
# File 'lib/docs/core/response.rb', line 27

def effective_url
  @effective_url ||= URL.parse super
end

#empty?Boolean


7
8
9
# File 'lib/docs/core/response.rb', line 7

def empty?
  body.empty?
end

#html?Boolean


15
16
17
# File 'lib/docs/core/response.rb', line 15

def html?
  mime_type.include? 'html'
end

#mime_typeObject


11
12
13
# File 'lib/docs/core/response.rb', line 11

def mime_type
  @mime_type ||= headers['Content-Type'] || 'text/plain'
end

#pathObject


23
24
25
# File 'lib/docs/core/response.rb', line 23

def path
  @path ||= url.path
end

#success?Boolean


3
4
5
# File 'lib/docs/core/response.rb', line 3

def success?
  code == 200
end

#urlObject


19
20
21
# File 'lib/docs/core/response.rb', line 19

def url
  @url ||= URL.parse request.base_url
end