Class: MultiRepo::ConfigEntry
- Inherits:
-
Object
- Object
- MultiRepo::ConfigEntry
- Defined in:
- lib/multirepo/files/config-entry.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#path ⇒ Object
Returns the value of attribute path.
-
#repo ⇒ Object
Returns the value of attribute repo.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #encode_with(coder) ⇒ Object
-
#initialize(repo) ⇒ ConfigEntry
constructor
A new instance of ConfigEntry.
- #name ⇒ Object
Constructor Details
#initialize(repo) ⇒ ConfigEntry
Returns a new instance of ConfigEntry.
19 20 21 22 23 |
# File 'lib/multirepo/files/config-entry.rb', line 19 def initialize(repo) @id = SecureRandom.uuid @path = repo.path @url = repo.exists? ? repo.remote('origin').url : nil end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
8 9 10 |
# File 'lib/multirepo/files/config-entry.rb', line 8 def id @id end |
#path ⇒ Object
Returns the value of attribute path.
9 10 11 |
# File 'lib/multirepo/files/config-entry.rb', line 9 def path @path end |
#repo ⇒ Object
Returns the value of attribute repo.
11 12 13 |
# File 'lib/multirepo/files/config-entry.rb', line 11 def repo @repo end |
#url ⇒ Object
Returns the value of attribute url.
10 11 12 |
# File 'lib/multirepo/files/config-entry.rb', line 10 def url @url end |
Instance Method Details
#==(other) ⇒ Object
25 26 27 28 29 |
# File 'lib/multirepo/files/config-entry.rb', line 25 def ==(other) other_path = Pathname.new(other.path) self_path = Pathname.new(path) other_path.exist? && self_path.exist? && other_path.realpath == self_path.realpath end |
#encode_with(coder) ⇒ Object
13 14 15 16 17 |
# File 'lib/multirepo/files/config-entry.rb', line 13 def encode_with(coder) coder["id"] = @id coder["path"] = @path coder["url"] = @url end |
#name ⇒ Object
35 36 37 |
# File 'lib/multirepo/files/config-entry.rb', line 35 def name repo.basename end |