Class: CIDE::ConfigFileLoader
- Inherits:
-
Object
- Object
- CIDE::ConfigFileLoader
- Defined in:
- lib/cide/config_file_loader.rb
Defined Under Namespace
Classes: Path
Instance Method Summary collapse
-
#initialize(config) ⇒ ConfigFileLoader
constructor
A new instance of ConfigFileLoader.
- #load(data) ⇒ Object
Constructor Details
#initialize(config) ⇒ ConfigFileLoader
16 17 18 |
# File 'lib/cide/config_file_loader.rb', line 16 def initialize(config) @config = config end |
Instance Method Details
#load(data) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/cide/config_file_loader.rb', line 20 def load(data) data.each_pair do |key, value| key = key.to_s path = Path.new(key) case key when 'from', 'image' then wanted_key(path, 'from', key) @config.from = expect_string(path, value) when 'as_root' then @config.as_root = maybe_step(path, value) when 'use_ssh' then @config.use_ssh = expect_boolean(path, value) when 'before' then @config.before = maybe_step(path, value) when 'env', 'forward_env' then wanted_key(path, 'env', key) @config.env = expect_env_hash(path, value) when 'export_dir' then @config.export_dir = maybe_string(path, value) when 'link', 'links' then @config.links = expect_links(path, value) when 'run', 'command' then wanted_key(path, 'run', key) @config.run = expect_run(path, value) when 'package' then @config.package = maybe_package(path, value) else unknown_key(path) end end @config end |