Module: Greased
- Extended by:
- Loggable
- Defined in:
- lib/greased/loggable.rb,
lib/greased.rb,
lib/greased/options.rb,
lib/greased/setting.rb,
lib/greased/settings.rb,
lib/greased/applicator.rb,
lib/greased/rails/engine.rb,
lib/greased/method_caller.rb,
lib/greased/rails/version.rb
Overview
Taken from Mongoid 4/2/2013 github.com/mongoid/mongoid/blob/master/lib/mongoid/loggable.rb
Defined Under Namespace
Modules: Loggable, Rails Classes: Applicator, MethodCaller, Options, Setting, Settings
Class Method Summary collapse
Methods included from Loggable
Class Method Details
.file_path(*args) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/greased.rb', line 24 def self.file_path(*args) path = File. File.join(*args) path = File.realpath(path) if File.exists?(path) #logger.debug "#{self.class}.#{__method__} path: #{path}" path end |
.load_yaml(filename, options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/greased.rb', line 7 def self.load_yaml(filename, = {}) # allow multiple filenames and use the first one that exists filename = Array.wrap(filename).find do |path| File.exists?(path).tap do |found| #logger.debug "#{self.class}.#{__method__} exists [#{found}]: #{path}" end end unless filename.nil? source = File.read(filename) source = ERB.new(source).result unless [:skip_erb] all = YAML.load(source) end all || {} end |