Class: LxcForge::Config
- Inherits:
-
Object
- Object
- LxcForge::Config
- Defined in:
- lib/lxc_forge/config.rb
Instance Attribute Summary collapse
-
#access_key_id ⇒ Object
Returns the value of attribute access_key_id.
-
#bucket ⇒ Object
Returns the value of attribute bucket.
-
#options ⇒ Object
Returns the value of attribute options.
-
#region ⇒ Object
Returns the value of attribute region.
-
#secret_access_key ⇒ Object
Returns the value of attribute secret_access_key.
Instance Method Summary collapse
- #config_file ⇒ Object
-
#initialize(options) ⇒ Config
constructor
A new instance of Config.
- #load ⇒ Object
-
#load_file(filename) ⇒ Object
TODO: Break up.
-
#save ⇒ Object
TODO: Break up.
- #to_hash ⇒ Object
Constructor Details
#initialize(options) ⇒ Config
Returns a new instance of Config.
7 8 9 |
# File 'lib/lxc_forge/config.rb', line 7 def initialize() @options = end |
Instance Attribute Details
#access_key_id ⇒ Object
Returns the value of attribute access_key_id.
5 6 7 |
# File 'lib/lxc_forge/config.rb', line 5 def access_key_id @access_key_id end |
#bucket ⇒ Object
Returns the value of attribute bucket.
5 6 7 |
# File 'lib/lxc_forge/config.rb', line 5 def bucket @bucket end |
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/lxc_forge/config.rb', line 5 def @options end |
#region ⇒ Object
Returns the value of attribute region.
5 6 7 |
# File 'lib/lxc_forge/config.rb', line 5 def region @region end |
#secret_access_key ⇒ Object
Returns the value of attribute secret_access_key.
5 6 7 |
# File 'lib/lxc_forge/config.rb', line 5 def secret_access_key @secret_access_key end |
Instance Method Details
#config_file ⇒ Object
11 12 13 |
# File 'lib/lxc_forge/config.rb', line 11 def config_file File.join(ENV["HOME"], ".lxc_forge.yml") end |
#load ⇒ Object
15 16 17 |
# File 'lib/lxc_forge/config.rb', line 15 def load load_file(config_file) end |
#load_file(filename) ⇒ Object
TODO: Break up
36 37 38 39 40 41 42 |
# File 'lib/lxc_forge/config.rb', line 36 def load_file(filename) data = File.read(filename) c = YAML.load(data) c.each do |k, v| send("#{k}=", v) end end |
#save ⇒ Object
TODO: Break up
29 30 31 32 33 |
# File 'lib/lxc_forge/config.rb', line 29 def save File.open(config_file, 'w') do |f| f.write(to_hash.to_yaml) end end |
#to_hash ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/lxc_forge/config.rb', line 19 def to_hash { :access_key_id => access_key_id, :secret_access_key => secret_access_key, :region => region, :bucket => bucket } end |