Module: Datadog::Profiling::Ext::DirClassMonkeyPatches
- Defined in:
- lib/datadog/profiling/ext/dir_monkey_patches.rb,
lib/datadog/profiling/ext/dir_monkey_patches.rb
Overview
Monkey patches for Dir.singleton_class (Ruby 3 version). See DirMonkeyPatches above for more details.
Instance Method Summary collapse
-
#[](*args, **kwargs, &block) ⇒ Object
Steep: Workaround that defines args, kwargs and block only for Ruby 3.x.
- #children(*args, **kwargs, &block) ⇒ Object
-
#each_child(*args, **kwargs, &block) ⇒ Object
See note on methods that yield above.
- #empty?(*args, **kwargs, &block) ⇒ Boolean
- #entries(*args, **kwargs, &block) ⇒ Object
-
#foreach(*args, **kwargs, &block) ⇒ Object
See note on methods that yield above.
-
#glob(*args, **kwargs, &block) ⇒ Object
See note on methods that yield above.
- #home(*args, **kwargs, &block) ⇒ Object
Instance Method Details
#[](*args, **kwargs, &block) ⇒ Object
Steep: Workaround that defines args, kwargs and block only for Ruby 3.x.
37 38 39 40 41 42 |
# File 'lib/datadog/profiling/ext/dir_monkey_patches.rb', line 37 def [](*args, &block) Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_hold_signals super ensure Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_resume_signals end |
#children(*args, **kwargs, &block) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/datadog/profiling/ext/dir_monkey_patches.rb', line 44 def children(*args, &block) Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_hold_signals super ensure Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_resume_signals end |
#each_child(*args, **kwargs, &block) ⇒ Object
See note on methods that yield above.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/datadog/profiling/ext/dir_monkey_patches.rb', line 57 def each_child(*args, &block) if block begin # <-- Begin critical region Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_hold_signals super do |entry_name| Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_resume_signals # <-- We're safe now while running customer code yield entry_name # <-- We'll go back to the Dir internals, critical region again Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_hold_signals end ensure # <-- End critical region Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_resume_signals end else # This returns an enumerator. We don't want/need to intercede here, the enumerator will eventually call the # other branch once it gets going. super end end |
#empty?(*args, **kwargs, &block) ⇒ Boolean
80 81 82 83 84 85 |
# File 'lib/datadog/profiling/ext/dir_monkey_patches.rb', line 80 def empty?(*args, &block) Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_hold_signals super ensure Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_resume_signals end |
#entries(*args, **kwargs, &block) ⇒ Object
87 88 89 90 91 92 |
# File 'lib/datadog/profiling/ext/dir_monkey_patches.rb', line 87 def entries(*args, &block) Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_hold_signals super ensure Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_resume_signals end |
#foreach(*args, **kwargs, &block) ⇒ Object
See note on methods that yield above.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/datadog/profiling/ext/dir_monkey_patches.rb', line 95 def foreach(*args, &block) if block begin # <-- Begin critical region Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_hold_signals super do |entry_name| Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_resume_signals # <-- We're safe now while running customer code yield entry_name # <-- We'll go back to the Dir internals, critical region again Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_hold_signals end ensure # <-- End critical region Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_resume_signals end else # This returns an enumerator. We don't want/need to intercede here, the enumerator will eventually call the # other branch once it gets going. super end end |
#glob(*args, **kwargs, &block) ⇒ Object
See note on methods that yield above.
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/datadog/profiling/ext/dir_monkey_patches.rb', line 119 def glob(*args, &block) if block begin # <-- Begin critical region Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_hold_signals super do |entry_name| Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_resume_signals # <-- We're safe now while running customer code yield entry_name # <-- We'll go back to the Dir internals, critical region again Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_hold_signals end ensure # <-- End critical region Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_resume_signals end else begin Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_hold_signals super ensure Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_resume_signals end end end |
#home(*args, **kwargs, &block) ⇒ Object
145 146 147 148 149 150 |
# File 'lib/datadog/profiling/ext/dir_monkey_patches.rb', line 145 def home(*args, &block) Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_hold_signals super ensure Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_resume_signals end |