Class: SelectPdfApi::YamlFileConfig
- Inherits:
-
Object
- Object
- SelectPdfApi::YamlFileConfig
- Defined in:
- lib/select_pdf_api/yaml_file_config.rb
Instance Method Summary collapse
-
#initialize(filename) ⇒ YamlFileConfig
constructor
A new instance of YamlFileConfig.
- #load_config(filename) ⇒ Object
- #options ⇒ Object
Constructor Details
#initialize(filename) ⇒ YamlFileConfig
Returns a new instance of YamlFileConfig.
4 5 6 7 |
# File 'lib/select_pdf_api/yaml_file_config.rb', line 4 def initialize(filename) @data = {} load_config filename end |
Instance Method Details
#load_config(filename) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/select_pdf_api/yaml_file_config.rb', line 9 def load_config(filename) config_file = File.join(File.(File.join('config')), filename) raise SelectPdfApi::ConfigError, "Config file #{config_file} does not exist." unless File.exist? config_file @data = YAML::load_file(config_file) raise SelectPdfApi::ConfigError, "Error loading values from #{config_file}" unless @data end |
#options ⇒ Object
20 21 22 |
# File 'lib/select_pdf_api/yaml_file_config.rb', line 20 def @data end |