Class: Grit::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/grit/config.rb

Instance Method Summary collapse

Constructor Details

#initialize(repo) ⇒ Config


4
5
6
# File 'lib/grit/config.rb', line 4

def initialize(repo)
  @repo = repo
end

Instance Method Details

#[](key) ⇒ Object


13
14
15
# File 'lib/grit/config.rb', line 13

def [](key)
  data[key]
end

#[]=(key, value) ⇒ Object


8
9
10
11
# File 'lib/grit/config.rb', line 8

def []=(key, value)
  @repo.git.config({}, key, value)
  @data = nil
end

#fetch(key, default = nil) ⇒ Object


17
18
19
# File 'lib/grit/config.rb', line 17

def fetch(key, default = nil)
  data[key] || default || raise(IndexError.new("key not found"))
end

#keysObject


21
22
23
# File 'lib/grit/config.rb', line 21

def keys
  data.keys
end