Class: Sem::Helpers::GitUrl
- Inherits:
-
Object
- Object
- Sem::Helpers::GitUrl
- Defined in:
- lib/sem/helpers/git_url.rb
Constant Summary collapse
- SSH_PATTERN =
example: [email protected]:renderedtext/cli.git
%r{^git@(.+)\..+\:(.+)\/(.+)\.git$}
- GITHUB_HTTP_PATTERN =
example: github.com/renderedtext/cli
%r{^(https:\/\/)?github.com/(.+)/(.+)$}
- BITBUCKET_HTTP_PATTERN =
example: bitbucket.org/renderedtext/cli
%r{^(https:\/\/)?bitbucket.org/(.+)/(.+)$}
Instance Attribute Summary collapse
-
#repo_name ⇒ Object
readonly
Returns the value of attribute repo_name.
-
#repo_owner ⇒ Object
readonly
Returns the value of attribute repo_owner.
-
#repo_provider ⇒ Object
readonly
Returns the value of attribute repo_provider.
Instance Method Summary collapse
-
#initialize(url) ⇒ GitUrl
constructor
A new instance of GitUrl.
- #valid? ⇒ Boolean
Constructor Details
#initialize(url) ⇒ GitUrl
Returns a new instance of GitUrl.
11 12 13 |
# File 'lib/sem/helpers/git_url.rb', line 11 def initialize(url) @repo_provider, @repo_owner, @repo_name = parse(url) end |
Instance Attribute Details
#repo_name ⇒ Object (readonly)
Returns the value of attribute repo_name.
7 8 9 |
# File 'lib/sem/helpers/git_url.rb', line 7 def repo_name @repo_name end |
#repo_owner ⇒ Object (readonly)
Returns the value of attribute repo_owner.
8 9 10 |
# File 'lib/sem/helpers/git_url.rb', line 8 def repo_owner @repo_owner end |
#repo_provider ⇒ Object (readonly)
Returns the value of attribute repo_provider.
9 10 11 |
# File 'lib/sem/helpers/git_url.rb', line 9 def repo_provider @repo_provider end |
Instance Method Details
#valid? ⇒ Boolean
15 16 17 |
# File 'lib/sem/helpers/git_url.rb', line 15 def valid? @repo_name && @repo_provider && @repo_owner end |