Class: GitRepo
- Inherits:
-
Object
- Object
- GitRepo
- Defined in:
- lib/gitrepo.rb
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#remote ⇒ Object
readonly
Returns the value of attribute remote.
Instance Method Summary collapse
- #find_remote ⇒ Object
-
#initialize(filename) ⇒ GitRepo
constructor
A new instance of GitRepo.
Constructor Details
#initialize(filename) ⇒ GitRepo
Returns a new instance of GitRepo.
3 4 5 6 |
# File 'lib/gitrepo.rb', line 3 def initialize(filename) @filename = filename @remote = "" end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
2 3 4 |
# File 'lib/gitrepo.rb', line 2 def filename @filename end |
#remote ⇒ Object (readonly)
Returns the value of attribute remote.
2 3 4 |
# File 'lib/gitrepo.rb', line 2 def remote @remote end |
Instance Method Details
#find_remote ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/gitrepo.rb', line 8 def find_remote() file = File.new(filename, "r") while (line = file.gets) if line.start_with?("[remote") @remote = file.gets.gsub("url = [email protected]:", "https://github.com/") break end end file.close @remote end |