Module: WGU::PPSCommons::InstanceMethods
- Defined in:
- lib/pps_commons.rb
Overview
Common instance methods
Instance Method Summary collapse
-
#deep_find(key, object = self, found = nil) ⇒ Object
instance version of self.deep_find().
- #logger(file = ENV['PPS_COMMONS_DEFAULT_LOG_LOCATION']) ⇒ Object
Instance Method Details
#deep_find(key, object = self, found = nil) ⇒ Object
instance version of self.deep_find()
47 48 49 |
# File 'lib/pps_commons.rb', line 47 def deep_find(key, object=self, found=nil) WGU::PPSCommons.deep_find(key, object) end |
#logger(file = ENV['PPS_COMMONS_DEFAULT_LOG_LOCATION']) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/pps_commons.rb', line 28 def logger(file = ENV['PPS_COMMONS_DEFAULT_LOG_LOCATION']) if @logger.nil? file ||= File.join('logs', 'log.log') puts "PPSCommons created a log file at #{file}" log = ::File.(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 |