Class: Milestoner::Git::Config
- Inherits:
-
Object
- Object
- Milestoner::Git::Config
- Defined in:
- lib/milestoner/git/config.rb
Overview
A lightweight Git Config wrapper.
Instance Method Summary collapse
- #get(key) ⇒ Object
-
#initialize(shell: Open3) ⇒ Config
constructor
A new instance of Config.
- #set(key, value) ⇒ Object
- #value(key) ⇒ Object
Constructor Details
#initialize(shell: Open3) ⇒ Config
Returns a new instance of Config.
9 10 11 |
# File 'lib/milestoner/git/config.rb', line 9 def initialize shell: Open3 @shell = shell end |
Instance Method Details
#get(key) ⇒ Object
13 14 15 |
# File 'lib/milestoner/git/config.rb', line 13 def get key shell.capture3 "git config --get #{key}" end |
#set(key, value) ⇒ Object
17 18 19 |
# File 'lib/milestoner/git/config.rb', line 17 def set key, value shell.capture3 %(git config --add #{key} "#{value}") end |
#value(key) ⇒ Object
21 22 23 |
# File 'lib/milestoner/git/config.rb', line 21 def value key get(key).first.chomp end |