Class: Arrow::Config::YamlLoader
- Inherits:
-
Loader
- Object
- Arrow::Object
- Loader
- Arrow::Config::YamlLoader
- Includes:
- Arrow::Constants
- Defined in:
- lib/arrow/config-loaders/yaml.rb
Overview
The Arrow::Config::YamlLoader class, a derivative of Arrow::Config::Loader. It is used to load configuration files written in YAML for the Arrow web application framework.
Authors
Michael Granger
Please see the file LICENSE in the top-level directory for licensing details.
Constant Summary
Constants included from Arrow::Constants
HTML_MIMETYPE, RUBY_MARSHALLED_MIMETYPE, RUBY_OBJECT_MIMETYPE, XHTML_MIMETYPE, YAML_DOMAIN
Instance Method Summary
-
- (Boolean) is_newer?(file, time)
Return true if the specified file is newer than the given time.
-
- (Object) load(filename)
Load and return configuration values from the YAML file specified.
-
- (Object) save(confighash, filename)
Save configuration values to the YAML file specified.
Methods inherited from Loader
Methods inherited from Arrow::Object
deprecate_class_method, deprecate_method, inherited
Methods included from Arrow::Loggable
Instance Method Details
- (Boolean) is_newer?(file, time)
Return true if the specified file is newer than the given time.
64 65 66 67 68 69 70 |
# File 'lib/arrow/config-loaders/yaml.rb', line 64 def is_newer?( file, time ) return false unless File.exists?( file ) st = File.stat( file ) self.log.debug "File mtime is: %s, comparison time is: %s" % [ st.mtime, time ] return st.mtime > time end |
- (Object) load(filename)
Load and return configuration values from the YAML file specified.
47 48 49 50 |
# File 'lib/arrow/config-loaders/yaml.rb', line 47 def load( filename ) self.log.info "Loading YAML-format configuration from '%s'" % filename return YAML.load_file( filename ) end |
- (Object) save(confighash, filename)
Save configuration values to the YAML file specified.
54 55 56 57 58 59 |
# File 'lib/arrow/config-loaders/yaml.rb', line 54 def save( confighash, filename ) self.log.info "Saving YAML-format configuration to '%s'" % filename File.open( filename, File::WRONLY|File::CREAT|File::TRUNC ) {|ofh| ofh.print( confighash.to_yaml ) } end |