Class: Worktrees::Models::Repository
- Inherits:
-
Object
- Object
- Worktrees::Models::Repository
- Defined in:
- lib/worktrees/models/repository.rb
Instance Attribute Summary collapse
-
#root_path ⇒ Object
readonly
Returns the value of attribute root_path.
Instance Method Summary collapse
- #branch_exists?(branch_name) ⇒ Boolean
- #config ⇒ Object
- #default_branch ⇒ Object
-
#initialize(root_path) ⇒ Repository
constructor
A new instance of Repository.
- #remote_url ⇒ Object
- #worktrees_path ⇒ Object
Constructor Details
#initialize(root_path) ⇒ Repository
Returns a new instance of Repository.
8 9 10 11 |
# File 'lib/worktrees/models/repository.rb', line 8 def initialize(root_path) @root_path = File.(root_path) validate_git_repository! end |
Instance Attribute Details
#root_path ⇒ Object (readonly)
Returns the value of attribute root_path.
6 7 8 |
# File 'lib/worktrees/models/repository.rb', line 6 def root_path @root_path end |
Instance Method Details
#branch_exists?(branch_name) ⇒ Boolean
17 18 19 |
# File 'lib/worktrees/models/repository.rb', line 17 def branch_exists?(branch_name) git_branch_exists?(branch_name) end |
#config ⇒ Object
29 30 31 |
# File 'lib/worktrees/models/repository.rb', line 29 def config @config ||= WorktreeConfig.load end |
#default_branch ⇒ Object
13 14 15 |
# File 'lib/worktrees/models/repository.rb', line 13 def default_branch git_default_branch end |
#remote_url ⇒ Object
21 22 23 |
# File 'lib/worktrees/models/repository.rb', line 21 def remote_url git_remote_url end |
#worktrees_path ⇒ Object
25 26 27 |
# File 'lib/worktrees/models/repository.rb', line 25 def worktrees_path config. end |