Sha256: f2ff03b11adb7a8883f3f4e2e15f740b4803d93250ecb1f5a79320223c70076c

Contents?: true

Size: 1.05 KB

Versions: 40

Compression:

Stored size: 1.05 KB

Contents

class Backtrace
  attr_reader :overrides

  def initialize(parent, package_name, version_name, config_name)
    @parent = parent
    @package_name = package_name
    @version_name = version_name
    @config_name = config_name || 'default'
    @overrides = {}
  end

  def collect(stack)
    if @parent
      @parent.collect(stack)
    end
    elem = ''
    if @package_name
      elem = @package_name
    end
    if @version_name
      elem += '/' + @version_name
    end
    if @config_name
      elem += ':' + @config_name
    end
    stack << elem
  end

  def add_override(package_name, version_name)
    # Don't replace an existing override on the stack
    return if get_override(package_name)
    @overrides[package_name] = version_name
  end

  def get_override(package_name)
    return @overrides[package_name] || (@parent ? @parent.get_override(package_name) : nil)
  end

  def dump(out)
    stack = []
    collect(stack)
    i=0
    for elem in stack
      indent=''
      i.times { indent += '  ' }
      out.puts indent+elem
      i += 1
    end
   end
end

Version data entries

40 entries across 40 versions & 2 rubygems

Version Path
fig18-0.1.46 lib/fig/backtrace.rb
fig18-0.1.46-i386-mswin32 lib/fig/backtrace.rb
fig18-0.1.46-i386-mingw32 lib/fig/backtrace.rb
fig-0.1.46 lib/fig/backtrace.rb
fig-0.1.46-java lib/fig/backtrace.rb
fig-0.1.45-java lib/fig/backtrace.rb
fig-0.1.45 lib/fig/backtrace.rb
fig18-0.1.45 lib/fig/backtrace.rb
fig18-0.1.45-i386-mswin32 lib/fig/backtrace.rb
fig18-0.1.45-i386-mingw32 lib/fig/backtrace.rb
fig18-0.1.42-mswin32 lib/fig/backtrace.rb
fig18-0.1.42-mingw32 lib/fig/backtrace.rb
fig-0.1.42-java lib/fig/backtrace.rb
fig-0.1.42 lib/fig/backtrace.rb
fig18-0.1.42 lib/fig/backtrace.rb
fig-0.1.41-java lib/fig/backtrace.rb
fig-0.1.41 lib/fig/backtrace.rb
fig18-0.1.41-x86_64-linux lib/fig/backtrace.rb
fig18-0.1.41 lib/fig/backtrace.rb
fig18-0.1.40 lib/fig/backtrace.rb