Class: RequireProfiler::Printer::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/require_profiler/printer.rb

Direct Known Subclasses

CallStack, Text

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ Base

Returns a new instance of Base.



9
10
11
12
13
14
15
16
17
18
# File 'lib/require_profiler/printer.rb', line 9

def initialize(output)
  @output = output

  # 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

#finishObject



24
25
26
# File 'lib/require_profiler/printer.rb', line 24

def finish
  output.close if output.respond_to?(:close) && output != $stdout
end

#flush(node) ⇒ Object

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/require_profiler/printer.rb', line 20

def flush(node)
  raise NotImplementedError
end