Last active
August 29, 2015 14:22
-
-
Save tgoldenberg/d0fd0eb2acaa090e0f28 to your computer and use it in GitHub Desktop.
HTTP request class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HttpRequest | |
attr_reader :method, :request_uri, :http_version | |
def initialize(website_string) | |
@method = website_string.split.first.upcase | |
@request_uri = website_string.split[1] | |
@http_version = website_string.split[2] | |
end | |
def to_hash | |
{method: @method, request_uri: @request_uri, http_version: @http_version} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment