Class: ConfigurationService::Factory::YamlFileContext
- Defined in:
- lib/configuration_service/factory/yaml_file_context.rb
Instance Method Summary collapse
-
#initialize(filename) ⇒ YamlFileContext
constructor
A factory context for a YAML file.
-
#scrub! ⇒ Object
Delete
filename
.
Methods inherited from Context
#decorators, #identifier, #identifier?, #provider_config, #provider_id, #token
Constructor Details
#initialize(filename) ⇒ YamlFileContext
A factory context for a YAML file
Note that #scrub! deletes the file. This context is intended to be used with a temporary file created by a bootstrapper.
For a context for the process ENV
and (on JRuby) system properties, see EnvironmentContext.
20 21 22 23 |
# File 'lib/configuration_service/factory/yaml_file_context.rb', line 20 def initialize(filename) @filename = File.(filename) @env = Context::SymbolicAccessWrapper.new(YAML.load_file(@filename)) end |
Instance Method Details
#scrub! ⇒ Object
Delete filename
30 31 32 33 |
# File 'lib/configuration_service/factory/yaml_file_context.rb', line 30 def scrub! File.unlink(@filename) if File.exist?(@filename) super end |