Class: Metanorma::Acme::Configuration
- Inherits:
-
Object
- Object
- Metanorma::Acme::Configuration
- Defined in:
- lib/metanorma/acme.rb
Constant Summary collapse
- CONFIG_ATTRS =
%i[ organization_name_short organization_name_long document_namespace docid_template i18nyaml logo_path header htmlcoverpage htmlintropage htmlstylesheet published_stages stage_abbreviations scripts scripts_pdf standardstylesheet validate_rng_file wordcoverpage wordintropage wordstylesheet xml_root_tag ].freeze
Instance Method Summary collapse
-
#initialize(*args) ⇒ Configuration
constructor
A new instance of Configuration.
- #set_default_values_from_yaml_file(config_file) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Configuration
Returns a new instance of Configuration.
39 40 41 42 43 44 45 46 |
# File 'lib/metanorma/acme.rb', line 39 def initialize(*args) super # Try to set config values from yaml file in current directory set_default_values_from_yaml_file(YAML_CONFIG_FILE) if File.file?(YAML_CONFIG_FILE) self.organization_name_short ||= ORGANIZATION_NAME_SHORT self.organization_name_long ||= ORGANIZATION_NAME_LONG self.document_namespace ||= DOCUMENT_NAMESPACE end |
Instance Method Details
#set_default_values_from_yaml_file(config_file) ⇒ Object
48 49 50 51 52 53 |
# File 'lib/metanorma/acme.rb', line 48 def set_default_values_from_yaml_file(config_file) = YAML.load(File.read(config_file)) CONFIG_ATTRS.each do |attr_name| instance_variable_set("@#{attr_name}", [attr_name.to_s]) end end |