Class: ConfigProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/yesman/config_proxy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfigProxy

Returns a new instance of ConfigProxy.



8
9
10
11
# File 'lib/yesman/config_proxy.rb', line 8

def initialize
  @params = nil
  @config_path = ".yesman/config"
end

Instance Attribute Details

#config_pathObject (readonly)

Returns the value of attribute config_path.



6
7
8
# File 'lib/yesman/config_proxy.rb', line 6

def config_path
  @config_path
end

#paramsObject (readonly)

Returns the value of attribute params.



5
6
7
# File 'lib/yesman/config_proxy.rb', line 5

def params
  @params
end

Instance Method Details

#config_exists?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/yesman/config_proxy.rb', line 33

def config_exists?
  return File.exists? config_path
end

#create_config(params) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/yesman/config_proxy.rb', line 13

def create_config params
  verify_config_exists
  File.open( config_path, "w" ) do |file| 
    file.write params.to_yaml
  end
  @params = params;
end

#load_configObject



21
22
23
24
# File 'lib/yesman/config_proxy.rb', line 21

def load_config
  verify_config_exists
  @params = YAML::load_file config_path
end