Module: WGU::PPSCommons
- Included in:
- DelegationAgent, Sentence
- Defined in:
- lib/pps_commons.rb
Defined Under Namespace
Modules: InstanceMethods
Class Method Summary collapse
-
.deep_find(key, object = self, found = nil) ⇒ Object
search through a hash’s nested keys for crap.
- .included(base) ⇒ Object
-
.unleash_the_fury_level ⇒ Object
this tells EventMachine how many threads it can use.
Class Method Details
.deep_find(key, object = self, found = nil) ⇒ Object
search through a hash’s nested keys for crap
12 13 14 15 16 17 18 19 |
# 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) ⇒ Object
7 8 9 |
# File 'lib/pps_commons.rb', line 7 def self.included(base) base.send :include, InstanceMethods end |
.unleash_the_fury_level ⇒ Object
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’
24 25 26 27 |
# File 'lib/pps_commons.rb', line 24 def PPSCommons.unleash_the_fury_level found = ENV['PPS_THREAD_COUNT'].to_i found.eql?(0) ? 40 : found.to_i end |