Class: Codeowners::Config
- Inherits:
-
Object
- Object
- Codeowners::Config
- Defined in:
- lib/codeowners/config.rb
Overview
Connfigure and manage the git config file.
Instance Method Summary collapse
- #default_organization ⇒ Object
- #default_organization=(name) ⇒ Object
- #default_owner ⇒ Object
- #default_owner=(name) ⇒ Object
-
#initialize(git = AnonymousGit.new) ⇒ Config
constructor
A new instance of Config.
- #to_h ⇒ Object
Constructor Details
#initialize(git = AnonymousGit.new) ⇒ Config
Returns a new instance of Config.
31 32 33 |
# File 'lib/codeowners/config.rb', line 31 def initialize(git = AnonymousGit.new) @git = git end |
Instance Method Details
#default_organization ⇒ Object
43 44 45 46 47 48 |
# File 'lib/codeowners/config.rb', line 43 def default_organization config_org = @git.config('user.organization') return config_org.strip unless config_org.nil? || config_org.strip.empty? parse_organization_from_origin || '' end |
#default_organization=(name) ⇒ Object
50 51 52 |
# File 'lib/codeowners/config.rb', line 50 def default_organization=(name) @git.config('user.organization', name) end |
#default_owner ⇒ Object
35 36 37 |
# File 'lib/codeowners/config.rb', line 35 def default_owner @git.config('user.owner') end |
#default_owner=(name) ⇒ Object
39 40 41 |
# File 'lib/codeowners/config.rb', line 39 def default_owner=(name) @git.config('user.owner', name) end |
#to_h ⇒ Object
54 55 56 57 58 59 |
# File 'lib/codeowners/config.rb', line 54 def to_h { default_owner: default_owner, default_organization: default_organization } end |