Class: CloudSync::Configuration
- Inherits:
-
Object
- Object
- CloudSync::Configuration
- Defined in:
- lib/cloud_sync/configuration.rb
Class Method Summary collapse
- .configure(map) ⇒ Object
- .get(key) ⇒ Object
- .load(file) ⇒ Object
- .method_missing(method, *args) ⇒ Object
- .put(key, val) ⇒ Object
Class Method Details
.configure(map) ⇒ Object
33 34 35 36 37 |
# File 'lib/cloud_sync/configuration.rb', line 33 def self.configure map map.each do |k,v| put k, v end end |
.get(key) ⇒ Object
8 9 10 |
# File 'lib/cloud_sync/configuration.rb', line 8 def self.get key @map[key.to_sym] end |
.load(file) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/cloud_sync/configuration.rb', line 25 def self.load file begin configure YAML.load_file(file) rescue raise IOError, "#{file} could not be loaded." end end |
.method_missing(method, *args) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/cloud_sync/configuration.rb', line 16 def self.method_missing method, *args if method.to_s =~ /=$/ return put method.to_s.chop, args.first else return get method end super end |
.put(key, val) ⇒ Object
12 13 14 |
# File 'lib/cloud_sync/configuration.rb', line 12 def self.put key, val @map[key.to_sym] = val end |