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