Class: Git::Worktree
Instance Attribute Summary collapse
-
#dir
Returns the value of attribute dir.
-
#full
Returns the value of attribute full.
-
#gcommit
Returns the value of attribute gcommit.
Attributes inherited from Path
Instance Method Summary collapse
- #add
-
#initialize(base, dir, gcommit = nil) ⇒ Worktree
constructor
A new instance of Worktree.
- #remove
- #to_a
- #to_s
Methods inherited from Path
Constructor Details
#initialize(base, dir, gcommit = nil) ⇒ Worktree
Returns a new instance of Worktree.
11 12 13 14 15 16 17 |
# File 'lib/git/worktree.rb', line 11 def initialize(base, dir, gcommit = nil) @full = dir @full += ' ' + gcommit if !gcommit.nil? @base = base @dir = dir @gcommit = gcommit end |
Instance Attribute Details
#dir
Returns the value of attribute dir.
9 10 11 |
# File 'lib/git/worktree.rb', line 9 def dir @dir end |
#full
Returns the value of attribute full.
9 10 11 |
# File 'lib/git/worktree.rb', line 9 def full @full end |
#gcommit
Returns the value of attribute gcommit.
9 10 11 |
# File 'lib/git/worktree.rb', line 9 def gcommit @gcommit end |
Instance Method Details
#add
24 25 26 |
# File 'lib/git/worktree.rb', line 24 def add @base.lib.worktree_add(@dir, @gcommit) end |
#remove
28 29 30 |
# File 'lib/git/worktree.rb', line 28 def remove @base.lib.worktree_remove(@dir) end |
#to_a
32 33 34 |
# File 'lib/git/worktree.rb', line 32 def to_a [@full] end |
#to_s
36 37 38 |
# File 'lib/git/worktree.rb', line 36 def to_s @full end |