class Metanorma::Acme::Configuration
Constants
- CONFIG_ATTRS
Attributes
_file[RW]
Public Class Methods
inherited( k )
click to toggle source
# File lib/metanorma/acme.rb, line 49 def self.inherited( k ) k._file = caller_locations.first.absolute_path end
new(*args)
click to toggle source
Calls superclass method
# File lib/metanorma/acme.rb, line 53 def initialize(*args) super # Try to set config values from yaml file in current directory @yaml = File.join(File.dirname(self.class::_file || __FILE__), "..", "..", YAML_CONFIG_FILE) set_default_values_from_yaml_file(@yaml) if File.file?(@yaml) self.organization_name_short ||= ORGANIZATION_NAME_SHORT self.organization_name_long ||= ORGANIZATION_NAME_LONG self.document_namespace ||= DOCUMENT_NAMESPACE end
Public Instance Methods
set_default_values_from_yaml_file(config_file)
click to toggle source
# File lib/metanorma/acme.rb, line 63 def set_default_values_from_yaml_file(config_file) default_config_options = YAML.load(File.read(config_file)) CONFIG_ATTRS.each do |attr_name| instance_variable_set("@#{attr_name}", default_config_options[attr_name.to_s]) end end