module WGU::PPSCommons

Public Class Methods

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

search through a hash's nested keys for crap

# File lib/pps_commons.rb, line 12
def PPSCommons.deep_find(key, object=self, found=nil)
  if object.respond_to?(:key?) && object.key?(key)
    object[key]
  elsif object.respond_to?(:each)
    object.find { |k,v| found = deep_find(key, v) }
    found
  end
end
included(base) click to toggle source
# File lib/pps_commons.rb, line 7
def self.included(base)
  base.send :include, InstanceMethods
end
unleash_the_fury_level() click to toggle source

this tells EventMachine how many threads it can use. There is a lot of Deferrals in this project so it helps to run a higher number. EM defaults to '20', PPS defaults to '40'. This can be adjusted by adjusting the `PPS_THREAD_COUNT` environment variable

# File lib/pps_commons.rb, line 25
def PPSCommons.unleash_the_fury_level
  found = ENV['PPS_THREAD_COUNT'].to_i
  found.eql?(0) ? 40 : found.to_i
end