class YNHttp
Public Class Methods
new(_status=200,_server="Apache-Coyote/1.1",_pragma="no-cache",_control="no-cache",_content_type="text/json",_charset="UTF-8",_body="")
click to toggle source
# File lib/yn_http.rb, line 3 def initialize(_status=200,_server="Apache-Coyote/1.1",_pragma="no-cache",_control="no-cache",_content_type="text/json",_charset="UTF-8",_body="") @status = _status @server = _server @pragma = _pragma @cache_control = _control @content_type = _content_type @charset = _charset @body = _body @content_length = _body.length end
Public Instance Methods
body=(result)
click to toggle source
# File lib/yn_http.rb, line 56 def body=(result) @content_length=result.size @body=result end
cache_control=(_control)
click to toggle source
# File lib/yn_http.rb, line 44 def cache_control=(_control) @cache_control=_control end
charset=(_charset)
click to toggle source
# File lib/yn_http.rb, line 52 def charset=(_charset) @charset=_charset end
content_type=(_content_type)
click to toggle source
# File lib/yn_http.rb, line 48 def content_type=(_content_type) @content_type=_content_type end
pragma=(_pragma)
click to toggle source
# File lib/yn_http.rb, line 40 def pragma=(_pragma) @pragma=_pragma end
response()
click to toggle source
# File lib/yn_http.rb, line 61 def response "HTTP/1.1 #{@status} #{@@status_hash[@status]}\r\n" + "Server:#{@server}\r\n" + "Pragma:#{@pragma}\r\n" + "Cache-Control:#{@cache_control}\r\n" + "Content-Type:#{@content_type};charset=#{@charset}\r\n" + "Content-Length:#{@content_length}\r\n" + "\r\n" + "#{@body}" end
server=(_server)
click to toggle source
# File lib/yn_http.rb, line 36 def server=(_server) @server=_server end
status=(_status)
click to toggle source
# File lib/yn_http.rb, line 32 def status=(_status) @status=_status end