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.
298 299 300 301 |
# File 'lib/hub/context.rb', line 298 def initialize(uri, project) @project = project super(uri) end |
Instance Attribute Details
#project ⇒ Object (readonly)
Returns the value of attribute project.
285 286 287 |
# File 'lib/hub/context.rb', line 285 def project @project end |
Class Method Details
.resolve(url, local_repo) ⇒ Object
289 290 291 292 293 294 295 296 |
# File 'lib/hub/context.rb', line 289 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
304 305 306 |
# File 'lib/hub/context.rb', line 304 def project_path path.split('/', 4)[3] end |