Class: ConfigModel
- Inherits:
-
WatirModel
- Object
- WatirModel
- ConfigModel
- Defined in:
- lib/config_model.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from WatirModel
#[], #apis, convert, convert_type, data_from_yaml, default_directory, default_value_keys, #eql?, factory_file, inherited, #initialize, key, #keys, method_missing, #to_api, #to_h, #to_hash, #to_json, #update, valid_keys, #valid_keys
Methods included from DataConversions
#convert_to_array, #convert_to_boolean, #convert_to_float, #convert_to_hash, #convert_to_integer, #convert_to_string, #convert_to_symbol, #convert_to_time, #parse_json
Constructor Details
This class inherits a constructor from WatirModel
Class Method Details
.create(hash = {}) ⇒ Object
2 3 4 5 6 7 |
# File 'lib/config_model.rb', line 2 def self.create(hash = {}) file = factory_file(self) env = ENV[self.to_s[/[^:]*$/].underscore.upcase] data = data_from_yaml(file, env) || {} new(data.merge hash) end |
Instance Method Details
#default_value(key, block) ⇒ Object
9 10 11 |
# File 'lib/config_model.rb', line 9 def default_value(key, block) ENV[key.to_s.upcase] || instance_exec(&block) end |