Class: Grit::Config
- Inherits:
-
Object
- Object
- Grit::Config
- Defined in:
- lib/grit/config.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #fetch(key, default = nil) ⇒ Object
-
#initialize(repo) ⇒ Config
constructor
A new instance of Config.
- #keys ⇒ Object
Constructor Details
#initialize(repo) ⇒ Config
Returns a new instance of 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 |
#keys ⇒ Object
21 22 23 |
# File 'lib/grit/config.rb', line 21 def keys data.keys end |