Class: Skriptorium::Config
- Inherits:
-
Object
- Object
- Skriptorium::Config
- Defined in:
- lib/skriptorium/config.rb
Instance Attribute Summary collapse
-
#destinations ⇒ Object
readonly
Returns the value of attribute destinations.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(source, destinations) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(source, destinations) ⇒ Config
Returns a new instance of Config.
5 6 7 8 |
# File 'lib/skriptorium/config.rb', line 5 def initialize(source, destinations) @source = source @destinations = destinations end |
Instance Attribute Details
#destinations ⇒ Object (readonly)
Returns the value of attribute destinations.
3 4 5 |
# File 'lib/skriptorium/config.rb', line 3 def destinations @destinations end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
3 4 5 |
# File 'lib/skriptorium/config.rb', line 3 def source @source end |
Class Method Details
.load(path) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/skriptorium/config.rb', line 10 def self.load(path) content = File.read(path) content = content.gsub(/\$\{(\w+)\}/) { ENV[$1] || raise("Environment variable #{$1} not set") } data = YAML.safe_load(content, permitted_classes: [Date, DateTime, Time, Symbol]) new(data['source'], data['destinations']) end |