Module: Plaintext::Configuration
- Defined in:
- lib/plaintext/configuration.rb
Class Attribute Summary collapse
-
.config ⇒ Object
Returns the value of attribute config.
Class Method Summary collapse
-
.[](name) ⇒ Object
Returns a configuration setting.
- .load(config_file = nil) ⇒ Object
Class Attribute Details
.config ⇒ Object
Returns the value of attribute config.
6 7 8 |
# File 'lib/plaintext/configuration.rb', line 6 def config @config end |
Class Method Details
.[](name) ⇒ Object
Returns a configuration setting
9 10 11 12 |
# File 'lib/plaintext/configuration.rb', line 9 def [](name) load if self.config.nil? self.config[name] end |
.load(config_file = nil) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/plaintext/configuration.rb', line 14 def load(config_file = nil) self.config = {} return unless config_file file_config = YAML::load(ERB.new(config_file).result) if file_config.is_a?(Hash) self.config = file_config else warn "`config_file` is not a valid Plaintext configuration file, ignoring." end end |