Class: Hub::Context::GithubURL
- Inherits:
-
URI::HTTPS
- Object
- URI::HTTPS
- 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.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*args) ⇒ GithubURL
constructor
A new instance of GithubURL.
-
#project_path ⇒ Object
segment of path after the project owner and name.
Constructor Details
#initialize(*args) ⇒ GithubURL
Returns a new instance of GithubURL.
289 290 291 292 |
# File 'lib/hub/context.rb', line 289 def initialize(*args) @project = args.pop super(*args) end |
Instance Attribute Details
#project ⇒ Object (readonly)
Returns the value of attribute project.
275 276 277 |
# File 'lib/hub/context.rb', line 275 def project @project end |
Class Method Details
.resolve(url, local_repo) ⇒ Object
279 280 281 282 283 284 285 286 287 |
# File 'lib/hub/context.rb', line 279 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.scheme, u.userinfo, u.host, u.port, u.registry, u.path, u.opaque, u.query, u.fragment, project) end rescue URI::InvalidURIError nil end |
Instance Method Details
#project_path ⇒ Object
segment of path after the project owner and name
295 296 297 |
# File 'lib/hub/context.rb', line 295 def project_path path.split('/', 4)[3] end |