Class: Coelacanth::Configure

Inherits:
Object
  • Object
show all
Defined in:
lib/coelacanth/configure.rb

Overview

Coelacanth::Configure

Constant Summary collapse

CONFIG_PATH =
"config/coelacanth.yml"

Instance Method Summary collapse

Instance Method Details

#read(key) ⇒ Object



11
12
13
14
15
# File 'lib/coelacanth/configure.rb', line 11

def read(key)
  return yaml[key] unless key.include?(".")

  key.split(".").reduce(yaml) { |hash, k| hash[k] }
end

#yamlObject



17
18
19
20
21
22
23
24
# File 'lib/coelacanth/configure.rb', line 17

def yaml
  @yaml ||= YAML.safe_load(
    ERB.new(File.read(file)).result,
    permitted_classes: [],
    permitted_symbols: [],
    aliases: true
  )[env]
end