Sha256: c7907e3937fd62a9d19ee9fe65c0242ed86eb616f2d0fa4abe8df881fa7891be

Contents?: true

Size: 635 Bytes

Versions: 1

Compression:

Stored size: 635 Bytes

Contents

# frozen_string_literal: true

module RShade
  class Stack
    attr_reader :config

    def initialize(config: nil, registry: ::RShade::Config::Registry.instance)
      @config = config || registry.default_stack_config
    end

    def self.trace(config: nil)
      new(config: config).trace
    end

    def trace
      config.exclude_gems!
      result = binding.callers.drop(2).map do |bind|
        frame = StackFrame.from_binding(bind)
        next nil unless config.filter.call(frame)

        frame
      end.compact.reverse
      config.formatter.call(result, variable_serializer: config.variable_serializer)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rshade-0.2.2 lib/rshade/stack.rb