class GemFootprintAnalyzer::Formatters::TextBase

Base class for all text formatters. Houses boilerplate and disclaimer text methods.

Public Class Methods

new(options = {}) click to toggle source

@param options [Hash<Symbol>] A hash of CLI options, to be used in disclaimer text

# File lib/gem_footprint_analyzer/formatters/text_base.rb, line 7
def initialize(options = {})
  @options = options
end

Public Instance Methods

dash(length) click to toggle source

@return [String] Awesome text separator

# File lib/gem_footprint_analyzer/formatters/text_base.rb, line 24
def dash(length)
  '-' * length
end
info() click to toggle source

Displays explanatory words for text formatter results

# File lib/gem_footprint_analyzer/formatters/text_base.rb, line 12
def info
  lines = []
  lines << "GemFootprintAnalyzer (#{GemFootprintAnalyzer::VERSION})"
  lines << (debug? ? "(#{File.expand_path(File.join(File.dirname(__FILE__), '..'))})\n" : '')
  lines << "Analyze results (average measured from #{@options[:runs]} run(s))"
  lines << 'time is the amount of time given require has taken to complete'
  lines << 'RSS is total memory increase up to the point after the require'
  lines << ''
  lines
end

Private Instance Methods

debug?() click to toggle source
# File lib/gem_footprint_analyzer/formatters/text_base.rb, line 30
def debug?
  @options[:debug]
end