Class: Dip::Config
- Inherits:
-
Object
- Object
- Dip::Config
- Defined in:
- lib/dip/config.rb
Constant Summary collapse
- DEFAULT_PATH =
"dip.yml"
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.exist? ⇒ Boolean
15 16 17 |
# File 'lib/dip/config.rb', line 15 def exist? File.exist?(path) end |
.load_yaml(file_path = path) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/dip/config.rb', line 27 def load_yaml(file_path = path) return {} unless File.exist?(file_path) YAML.safe_load( ERB.new(File.read(file_path)).result, [], [], true ).deep_symbolize_keys! end |
.override_path ⇒ Object
23 24 25 |
# File 'lib/dip/config.rb', line 23 def override_path path.gsub(/\.yml$/, ".override.yml") end |
.path ⇒ Object
19 20 21 |
# File 'lib/dip/config.rb', line 19 def path ENV["DIP_FILE"] || File.join(Dir.pwd, DEFAULT_PATH) end |
Instance Method Details
#to_h ⇒ Object
43 44 45 |
# File 'lib/dip/config.rb', line 43 def to_h config end |