Class: Marseditsync::Config
- Inherits:
-
Object
- Object
- Marseditsync::Config
- Defined in:
- lib/marseditsync.rb
Instance Attribute Summary collapse
-
#common_original_host ⇒ Object
readonly
Returns the value of attribute common_original_host.
Instance Method Summary collapse
- #config_value(section, key, require) ⇒ Object
-
#initialize(yaml) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(yaml) ⇒ Config
Returns a new instance of Config.
19 20 21 22 |
# File 'lib/marseditsync.rb', line 19 def initialize(yaml) @yaml = yaml @common_original_host = config_value('common', 'original_host', true) end |
Instance Attribute Details
#common_original_host ⇒ Object (readonly)
Returns the value of attribute common_original_host.
23 24 25 |
# File 'lib/marseditsync.rb', line 23 def common_original_host @common_original_host end |
Instance Method Details
#config_value(section, key, require) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/marseditsync.rb', line 25 def config_value(section, key, require) value = @yaml[section][key] if require && (value.nil? || value.empty?) raise RuntimeError, "#{section}:#{key}: is empty" end value end |