Class: Metanorma::Release::RepoRef
- Inherits:
-
Object
- Object
- Metanorma::Release::RepoRef
- Defined in:
- lib/metanorma/release/repo_ref.rb
Instance Attribute Summary collapse
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Class Method Summary collapse
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(owner:, repo:) ⇒ RepoRef
constructor
A new instance of RepoRef.
- #to_s ⇒ Object
Constructor Details
#initialize(owner:, repo:) ⇒ RepoRef
Returns a new instance of RepoRef.
15 16 17 18 19 |
# File 'lib/metanorma/release/repo_ref.rb', line 15 def initialize(owner:, repo:) @owner = owner @repo = repo freeze end |
Instance Attribute Details
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
6 7 8 |
# File 'lib/metanorma/release/repo_ref.rb', line 6 def owner @owner end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
6 7 8 |
# File 'lib/metanorma/release/repo_ref.rb', line 6 def repo @repo end |
Class Method Details
.from_string(str) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/metanorma/release/repo_ref.rb', line 8 def self.from_string(str) parts = str.split('/', 2) raise ArgumentError, "Invalid repo reference: #{str}" unless parts.length == 2 new(owner: parts[0], repo: parts[1]) end |
Instance Method Details
#eql?(other) ⇒ Boolean
25 26 27 |
# File 'lib/metanorma/release/repo_ref.rb', line 25 def eql?(other) other.is_a?(self.class) && owner == other.owner && repo == other.repo end |
#hash ⇒ Object
29 30 31 |
# File 'lib/metanorma/release/repo_ref.rb', line 29 def hash [owner, repo].hash end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/metanorma/release/repo_ref.rb', line 21 def to_s "#{owner}/#{repo}" end |