Class: RequireProfiler::Plugins::YAMLPlugin
- Defined in:
- lib/require_profiler/plugins/yaml_plugin.rb
Overview
Track loading YAML files
Defined Under Namespace
Modules: Patch
Class Attribute Summary collapse
-
.reporter ⇒ Object
Returns the value of attribute reporter.
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from RequireProfiler::Plugins::Base
Class Attribute Details
.reporter ⇒ Object
Returns the value of attribute reporter.
22 23 24 |
# File 'lib/require_profiler/plugins/yaml_plugin.rb', line 22 def reporter @reporter end |
Class Method Details
.track(path) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/require_profiler/plugins/yaml_plugin.rb', line 24 def track(path) reporter.handle_event(Reporter::Event.new(type: :start, kind: :yml, path:)) start = Time.now yield ensure time = Time.now - start reporter.handle_event(Reporter::Event.new(type: :end, path:, time:)) end |
Instance Method Details
#activate! ⇒ Object
34 35 36 37 38 39 |
# File 'lib/require_profiler/plugins/yaml_plugin.rb', line 34 def activate! require "yaml" YAMLPlugin.reporter = reporter ::YAML.singleton_class.prepend(Patch) end |