module WGU::PPSCommons::InstanceMethods

Common instance methods

Public Instance Methods

deep_find(key, object=self, found=nil) click to toggle source

instance version of +self.deep_find()+

# File lib/pps_commons.rb, line 53
def deep_find(key, object=self, found=nil)
  WGU::PPSCommons.deep_find(key, object)
end
logger(file = ENV['PPS_COMMONS_DEFAULT_LOG_LOCATION'] || STDOUT) click to toggle source
# File lib/pps_commons.rb, line 32
def logger(file = ENV['PPS_COMMONS_DEFAULT_LOG_LOCATION'] || STDOUT)
  if @logger.nil?
    log = file.eql?(STDOUT) ? file : nil

    unless file.eql? STDOUT
      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
    end

    Logger.new(log)
  else
    @logger
  end
end