Class: Hub::Context::GithubURL
- Extended by:
- Forwardable
- Defined in:
- lib/hub/context.rb
Instance Attribute Summary collapse
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Attributes inherited from URI::HTTP
#fragment, #host, #password, #path, #port, #query, #scheme, #user
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(uri, project) ⇒ GithubURL
constructor
A new instance of GithubURL.
-
#project_path ⇒ Object
segment of path after the project owner and name.
Methods inherited from URI::HTTP
#find_proxy, #request_uri, #to_s, #userinfo, #userinfo=
Constructor Details
#initialize(uri, project) ⇒ GithubURL
Returns a new instance of GithubURL.
332 333 334 335 |
# File 'lib/hub/context.rb', line 332 def initialize(uri, project) @project = project super(uri) end |
Instance Attribute Details
#project ⇒ Object (readonly)
Returns the value of attribute project.
319 320 321 |
# File 'lib/hub/context.rb', line 319 def project @project end |
Class Method Details
.resolve(url, local_repo) ⇒ Object
323 324 325 326 327 328 329 330 |
# File 'lib/hub/context.rb', line 323 def self.resolve(url, local_repo) u = URI(url) if %[http https].include? u.scheme and project = GithubProject.from_url(u, local_repo) self.new(u, project) end rescue URI::InvalidURIError nil end |
Instance Method Details
#project_path ⇒ Object
segment of path after the project owner and name
338 339 340 |
# File 'lib/hub/context.rb', line 338 def project_path path.split('/', 4)[3] end |