Class: RequireProfiler::Printer::Base
- Inherits:
-
Object
- Object
- RequireProfiler::Printer::Base
- Defined in:
- lib/require_profiler/printer.rb
Instance Method Summary collapse
- #finish ⇒ Object
- #flush(node) ⇒ Object
-
#initialize(output, threshold: 0.0, focus: nil) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(output, threshold: 0.0, focus: nil) ⇒ Base
Returns a new instance of Base.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/require_profiler/printer.rb', line 9 def initialize(output, threshold: 0.0, focus: nil) @output = output @threshold = threshold @focus = focus # Identify prefixes for the project and the gems prefixes = [::Dir.pwd] prefixes << ::Gem.dir if defined?(::Gem.dir) prefixes << ::Bundler.bundle_path if defined?(::Bundler.bundle_path) @prefix_stripper = %r{^(#{prefixes.join("|")})/} end |
Instance Method Details
#finish ⇒ Object
26 27 28 |
# File 'lib/require_profiler/printer.rb', line 26 def finish output.close if output.respond_to?(:close) && output != $stdout end |
#flush(node) ⇒ Object
22 23 24 |
# File 'lib/require_profiler/printer.rb', line 22 def flush(node) raise NotImplementedError end |