Class: Gringotts::Config
- Inherits:
-
Object
- Object
- Gringotts::Config
- Defined in:
- lib/gringotts/config.rb
Class Method Summary collapse
Class Method Details
.load(raw_yaml) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/gringotts/config.rb', line 11 def self.load(raw_yaml) begin yaml = YAML.load(raw_yaml)[Rails.env] rescue Exception => e raise "Unable to load YAML [#{e.}]" end @@enabled = parse(yaml, "enabled") @@twilio = parse(yaml, "twilio", false) @@delivery = parse(yaml, "delivery", false) @@ignore_paths = parse(yaml, "ignore_paths", false) @@loaded = true end |
.loaded? ⇒ Boolean
7 8 9 |
# File 'lib/gringotts/config.rb', line 7 def self.loaded? return (@@loaded == true) end |
.parse(yaml, node, required = true) ⇒ Object
25 26 27 28 29 |
# File 'lib/gringotts/config.rb', line 25 def self.parse(yaml, node, required = true) value = yaml[node.to_s] raise "Missing required value for [#{node}] in config/gringotts.yml" if required && value.nil? return value end |