Class: Watobo::Response
- Inherits:
-
Array
- Object
- Array
- Watobo::Response
show all
- Defined in:
- lib/watobo/core/response.rb
Overview
Constant Summary
Constants included
from Diff::LCS
Diff::LCS::BalancedCallbacks, Diff::LCS::PATCH_MAP, Diff::LCS::SequenceCallbacks, Diff::LCS::VERSION
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Diff::LCS
LCS, __diff_direction, __inverse_vector, __lcs, __normalize_patchset, __position_hash, __replace_next_larger, diff, #diff, #lcs, patch, #patch, #patch!, patch!, sdiff, #sdiff, traverse_balanced, #traverse_balanced, traverse_sequences, #traverse_sequences, #unpatch, #unpatch!, unpatch!
Constructor Details
#initialize(r) ⇒ Response
Returns a new instance of Response.
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/watobo/core/response.rb', line 42
def initialize(r)
if r.respond_to? :concat
self.concat r
elsif r.is_a? String
raise ArgumentError, "Need Array"
end
self.extend Watobo::Mixin::Parser::Url
self.extend Watobo::Mixin::Parser::Web10
self.extend Watobo::Mixin::Shaper::Web10
self.extend Watobo::Mixin::Shaper::HttpResponse
if content_type =~ /(html|text)/
self.extend Watobo::Parser::HTML
end
end
|
Class Method Details
.create(response) ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/watobo/core/response.rb', line 13
def self.create( response )
raise ArgumentError, "Array Expected." unless response.is_a? Array
response.extend Watobo::Mixin::Parser::Url
response.extend Watobo::Mixin::Parser::Web10
response.extend Watobo::Mixin::Shaper::Web10
response.extend Watobo::Mixin::Shaper::HttpResponse
end
|
.is_html? ⇒ Boolean
4
5
6
|
# File 'lib/watobo/core/response.rb', line 4
def self.is_html?
end
|
.is_json? ⇒ Boolean
8
9
10
|
# File 'lib/watobo/core/response.rb', line 8
def self.is_json?
end
|
Instance Method Details
#copy ⇒ Object
37
38
39
40
|
# File 'lib/watobo/core/response.rb', line 37
def copy
c = Watobo::Utils.copyObject self
Watobo::Request.new c
end
|
#data ⇒ Object
33
34
35
|
# File 'lib/watobo/core/response.rb', line 33
def data
@data
end
|
#to_s ⇒ Object
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/watobo/core/response.rb', line 21
def to_s
data = self.join
unless has_body?
data << "\r\n" unless data =~ /\r\n\r\n$/
end
data
end
|