Module: RakeCommander::Patcher::Debug
- Included in:
- Application::TopLevelResume::ClassMethods
- Defined in:
- lib/rake-commander/patcher/debug.rb
Overview
Helpers to patch
Instance Method Summary collapse
-
#rake_comm_debug(msg, prefix = '', num: nil, pid: false) ⇒ Object
Helper for debugging.
- #rake_comm_debug_main_object_id ⇒ Object
- #rake_comm_debug_random_object_id ⇒ Object
Instance Method Details
#rake_comm_debug(msg, prefix = '', num: nil, pid: false) ⇒ Object
Helper for debugging
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/rake-commander/patcher/debug.rb', line 6 def rake_comm_debug(msg, prefix = '', num: nil, pid: false) return unless RakeCommander::Patcher.debug? rake_comm_debug_random_object_id num = num ? "#{num}. " : nil if pid = "(PID: #{Process.pid} ++ Thread: #{Thread.current.object_id} ++ Ruby 'main': #{rake_comm_debug_main_object_id})" msg = "#{prefix}( #{num}#{Rake.application.object_id}) #{msg} #{}" elsif num msg = "#{prefix}( #{num}) #{msg} " end puts msg end |
#rake_comm_debug_main_object_id ⇒ Object
19 20 21 |
# File 'lib/rake-commander/patcher/debug.rb', line 19 def rake_comm_debug_main_object_id eval('self.object_id', TOPLEVEL_BINDING, __FILE__, __LINE__) end |
#rake_comm_debug_random_object_id ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/rake-commander/patcher/debug.rb', line 23 def rake_comm_debug_random_object_id return false if @rake_comm_debug_random_object_id @rake_comm_debug_random_object_id = Array(1..20).sample.times.map do |i| i.to_s.tap(&:object_id) end true end |