Skip to content

Instantly share code, notes, and snippets.

@tgoldenberg
Last active August 29, 2015 14:22
Show Gist options
  • Save tgoldenberg/d0fd0eb2acaa090e0f28 to your computer and use it in GitHub Desktop.
Save tgoldenberg/d0fd0eb2acaa090e0f28 to your computer and use it in GitHub Desktop.
HTTP request class
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