Module: WGU::PPSCommons::InstanceMethods

Defined in:
lib/pps_commons.rb

Overview

Common instance methods

Instance Method Summary collapse

Instance Method Details

#deep_find(key, object = self, found = nil) ⇒ Object

instance version of self.deep_find()



48
49
50
# File 'lib/pps_commons.rb', line 48

def deep_find(key, object=self, found=nil)
  WGU::PPSCommons.deep_find(key, object)
end

#logger(file = ENV['PPS_COMMONS_DEFAULT_LOG_LOCATION']) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/pps_commons.rb', line 31

def logger(file = ENV['PPS_COMMONS_DEFAULT_LOG_LOCATION'])
  if @logger.nil?
    log = ::File.expand_path(file)
    unless ::File.exist?(log)
      log_dir = File.dirname(log)
      unless ::Dir.exist?(log_dir)
        ::FileUtils.mkdir_p(log_dir)
      end
      ::File.new(log, 'a+')
    end

    Logger.new(log)
  else
    @logger
  end
end