Class: CIJoe::Config

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, parent = nil) ⇒ Config

Returns a new instance of Config.



7
8
9
10
# File 'lib/cijoe/config.rb', line 7

def initialize(command, parent = nil)
  @command = command
  @parent = parent
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(command, *args) ⇒ Object



12
13
14
# File 'lib/cijoe/config.rb', line 12

def method_missing(command, *args)
  Config.new(command, self)
end

Class Method Details

.method_missing(command, *args) ⇒ Object



3
4
5
# File 'lib/cijoe/config.rb', line 3

def self.method_missing(command, *args)
  new(command)
end

Instance Method Details

#config_stringObject



20
21
22
# File 'lib/cijoe/config.rb', line 20

def config_string
  @parent ? "#{@parent.config_string}.#{@command}" : @command
end

#to_sObject



16
17
18
# File 'lib/cijoe/config.rb', line 16

def to_s
  `git config #{config_string}`.chomp
end