Class: ConfigProxy
- Inherits:
-
Object
- Object
- ConfigProxy
- Defined in:
- lib/yesman/config_proxy.rb
Instance Attribute Summary collapse
-
#config_path ⇒ Object
readonly
Returns the value of attribute config_path.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #config_exists? ⇒ Boolean
- #create_config(params) ⇒ Object
-
#initialize ⇒ ConfigProxy
constructor
A new instance of ConfigProxy.
- #load_config ⇒ Object
Constructor Details
#initialize ⇒ ConfigProxy
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_path ⇒ Object (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 |
#params ⇒ Object (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
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_config ⇒ Object
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 |