Parent

Files

Grit::Config

Public Class Methods

new(repo) click to toggle source
# File lib/grit/config.rb, line 4
def initialize(repo)
  @repo = repo
end

Public Instance Methods

[](key) click to toggle source
# File lib/grit/config.rb, line 13
def [](key)
  data[key]
end
[]=(key, value) click to toggle source
# File lib/grit/config.rb, line 8
def []=(key, value)
  @repo.git.config({}, key, value)
  @data = nil
end
fetch(key, default = nil) click to toggle source
# File lib/grit/config.rb, line 17
def fetch(key, default = nil)
  data[key] || default || raise(IndexError.new("key not found"))
end
keys() click to toggle source
# File lib/grit/config.rb, line 21
def keys
  data.keys
end

Protected Instance Methods

config_lines() click to toggle source
# File lib/grit/config.rb, line 39
def config_lines
  @repo.git.config(:list => true).split(/\n/)
end
data() click to toggle source
# File lib/grit/config.rb, line 26
def data
  @data ||= load_config
end
load_config() click to toggle source
# File lib/grit/config.rb, line 30
def load_config
  hash = {}
  config_lines.map do |line|
    key, value = line.split(/=/, 2)
    hash[key] = value
  end
  hash
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.